"within graphic" question

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

"within graphic" question

Mark Wieder via use-livecode
Hi list,

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 ?

Thanks in advance.
jbv

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: "within graphic" question

Mark Wieder via use-livecode
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.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: "within graphic" question

Mark Wieder via use-livecode
Would it work in your case if you left the graphic visible and set the blendLevel to 99?

be well,
randy

> On Feb 22, 2021, at 2:14 PM, Richard Gaskin via use-livecode <[hidden email]> wrote:
>
> 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.
>
> --
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> ____________________________________________________________________
> [hidden email]                http://www.FourthWorld.com
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: "within graphic" question

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode


> 22. feb. 2021 kl. 21:14 skrev Richard Gaskin via use-livecode <[hidden email]>:
>
> 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

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: "within graphic" question

Mark Wieder via use-livecode


> 22. feb. 2021 kl. 21:26 skrev Tore Nilsen via use-livecode <[hidden email]>:
>
>
>
>> 22. feb. 2021 kl. 21:14 skrev Richard Gaskin via use-livecode <[hidden email]>:
>>
>> 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

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: "within graphic" question

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
If you're willing to do something "hackish", you could do this:

on mouseDown
  lock screen
  show grc "mygraphic"
  put within(grc "mygraphic",the clickloc)
  hide grc "mygraphic"
  unlock screen
end mouseDown

:D

Ken


> On Feb 22, 2021, at 1:49 PM, jbv via use-livecode <[hidden email]> wrote:
>
> Hi list,
>
> 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 ?
>
> Thanks in advance.
> jbv
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: "within graphic" question

Mark Wieder via use-livecode
In reply to this post by Mark Wieder via use-livecode
Le 2021-02-22 15:26, Tore Nilsen via use-livecode a écrit :

>
> 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

Thank you, but this won't work for I need to test the
exact shape of the graphics, not its bounding box...

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: "within graphic" question

Mark Wieder via use-livecode
 I’ve had this problem before and solved it with a work-around/hack using the intersect of 2 graphics with small alpha values.

Roger

> On Feb 22, 2021, at 2:02 PM, jbv via use-livecode <[hidden email]> wrote:
>
> Le 2021-02-22 15:26, Tore Nilsen via use-livecode a écrit :
>> 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
>
> Thank you, but this won't work for I need to test the
> exact shape of the graphics, not its bounding box...
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode