"within graphic" question

Tore Nilsen tore.nilsen at me.com
Mon Feb 22 15:29:00 EST 2021



> 22. feb. 2021 kl. 21:26 skrev Tore Nilsen via use-livecode <use-livecode at lists.runrev.com>:
> 
> 
> 
>> 22. feb. 2021 kl. 21:14 skrev Richard Gaskin via use-livecode <use-livecode at lists.runrev.com>:
>> 
>> jbv wrote:
>>> I have a graphic made of a list of points. This graphic is opaque
>>> and invisible, its filled property is set to true (according to
>>> the doc).
>>> In my card script I have something like :
>>> on mousedown
>>>  put within(grc "mygraphic", the clickloc)
>>> end mousedown
>>> but it always returns false, even when I click
>>> inside the clickable area of the graphic...
>>> What am I missing ?
>> 
>> IIRC invisible objects are removed from not only the rendering queue, but hit-testing as well.
>> 
> 
> Since the properties of the arc is available even if it is invisible, this will work though:
> 
> on mouseDown
> 
> put isWithin("myGraphic",the clickLoc)
> 
> end mouseDown
> 
> 
> function isWithin pGraphic pClickLoc
> 
> if pClickLoc is within the rect of grc pGraphic then
> 
> return true
> 
> else
> 
> return false
> 
> end if
> 
> end isWithin
> 
> 
> Best regards
> TORE NILSEN

I missed the part where you described your graphic. My solution will only work on a graphic that is a rectangle.

Tore Nilsen




More information about the use-livecode mailing list