isClicWithinOvalColoredPart

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

isClicWithinOvalColoredPart

Post by jmburnod » Wed Nov 06, 2013 7:42 pm

Hi All,

I'm coming back with this problem
I search a way to know if the click is within the colored part of the blue oval.
The "by color" way work well but an "by angle" way should be better.
I write a script to do that but it doesn't work yet as you can see in the attached stack

Thank again for help

Kind regards

Jean-marc
Attachments
isClicWithinOvalColoredPart.livecode.zip
(1.73 KiB) Downloaded 141 times
https://alternatic.ch

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: isClicWithinOvalColoredPart

Post by dunbarx » Wed Nov 06, 2013 9:40 pm

Jean-Marc.

The "color" check portion of your handler needs to be in the card script, because if you click outside the object area, it will not work. You have to watch the reference to the target in line 34 if you do, though.

It seems like you can find the equations of the two lines that define your arc section, since you know the slopes of the two radii and also the center of the graphic. With that you can take the clickLoc and determine whether that loc is greater or lesser than the substitution of that point into the two equations. If it is greater than both, then the point lies outside the area subtended by the arc section. At least for a positive-going pair of lines in quadrant 1. The determination may have to be a mixture of < and > in the other three quadrants. I have not played with those yet.

Hey HH, or whatever your name is. A little help here?

Craig

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: isClicWithinOvalColoredPart

Post by bn » Wed Nov 06, 2013 10:13 pm

Salut Jean-Marc,

ravi de te revoir.

Here is a little different formula to get the angle of the mouse and for me it works

Kind regards

Bernd
Attachments
Jean-Marc InsideAngle.livecode.zip
(1.67 KiB) Downloaded 149 times

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: isClicWithinOvalColoredPart

Post by jmburnod » Wed Nov 06, 2013 10:43 pm

Salut Bernd,
Thanks a lot
ravi de te revoir.
Me too. I'm happy to know you can see me through the web without camera.
Amazing man.
I tested your script and it works for me
The "angle way" is better than the "color way" if we have ovals with the same backgroundcolor

Kind regards

Jean-Marc
https://alternatic.ch

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: isClicWithinOvalColoredPart

Post by jmburnod » Fri Nov 08, 2013 7:24 pm

Hi Craig,
Sorry
Bernd made me so happy with his script. I have forgotten to you thank for explanations. :oops:
This team is definitively the best I never meet. :D
Thank again
Jean-Marc
https://alternatic.ch

Post Reply