Page 1 of 3
"opaque pixels"
Posted: Fri Jan 21, 2022 10:38 am
by Samuele
Hi, is there a way to activate "mouseDown" only if the user clicks on the "opaque pixels" of the object?
Thanks!
Samule.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 1:52 pm
by richmond62
There is no "way" as it happens automatically:
-
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 3:57 pm
by dunbarx
I believe there is a property, “the mouseColor”, or something like that. I am not near my computer.
Anyway I think it it empty if the cursor is over an “empty” pixel.
Craig
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 4:01 pm
by Klaus
dunbarx wrote: ↑Fri Jan 21, 2022 3:57 pm
I believe there is a property, “the mouseColor”, or something like that. I am not near my computer.
Anyway I think it it empty if the cursor is over an “empty” pixel.
No, "the mousecolor" will not be empty but return the color of the object behind the object with the opaque pixels, usually the card.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 4:17 pm
by dunbarx
Not near my computer.
But then there is a property that returns the “pixelColor”. What is it?
Craig
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 4:40 pm
by Klaus
Hm, did not find "pixelcolor" in the dictionary?!
And not in the old Metacard index (dictionay) either.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 5:21 pm
by richmond62
There is no need to fuss about this as a PNG image containing transparent areas
will only 'catch' mouse messages when the end-user interacts with the opaque
part of the image, as my example stack above demonstrates.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 5:43 pm
by Klaus
richmond62 wrote: ↑Fri Jan 21, 2022 5:21 pm
There is no need to fuss about this ...
Who are you and what have you done to richmind62?
richmond62 wrote: ↑Fri Jan 21, 2022 5:21 pm
... as a PNG image containing transparent areas will only 'catch' mouse messages when the end-user interacts with the opaque part of the image, as my example stack above demonstrates.
Yes, we already understood this, I was only anwering Craigs questions.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 5:50 pm
by richmond62
richmind62
only anwering Craigs
and who are you, and what are you 'on' with those mistakes . . .
If you want to be "clever" you could have a one pixel image that was always at the
mouseLoc and
then use
intersect . . .

Re: "opaque pixels"
Posted: Fri Jan 21, 2022 5:53 pm
by Klaus
You should see "richmind62" as an accolade, Sir!
And I don't want to be clever, I AM clever!

Re: "opaque pixels"
Posted: Fri Jan 21, 2022 6:52 pm
by jacque
richmond62 wrote: ↑Fri Jan 21, 2022 5:21 pm
a PNG image containing transparent areas will only 'catch' mouse messages when the end-user interacts with the opaque part of the image
Samuele, this is the answer. If the image has an alpha channel, like PNG does, then it will do what you want.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 7:34 pm
by Klaus
jacque wrote: ↑Fri Jan 21, 2022 6:52 pm
richmond62 wrote: ↑Fri Jan 21, 2022 5:21 pm
a PNG image containing transparent areas will only 'catch' mouse messages when the end-user interacts with the opaque part of the image
Samuele, this is the answer. If the image has an alpha channel, like PNG does, then it will do what you want.
But Samuele actually wants the opposite!
He wrote:
...
is there a way to activate "mouseDown"
only if the user clicks on the "opaque pixels" of the object?
...
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 7:38 pm
by richmond62
No: he does not want the opposite.
In my example stack the opaque pixels constitute the image,
while the transparent ones inwith the image's bounding rectangle are
transparent.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 8:01 pm
by Klaus
If we click on a tranparent pixel in an image, LC does not see this pixel, but the one below it.
So we cannot have "mousedown" here! if we add a mousedown handler to the image, this will
only get executed when clicking a non transparent pixel.
You demonstrated this nicely with your example stack, only "mousedown" in the card script
will get fired when clicking a tranparent pixel.
Re: "opaque pixels"
Posted: Fri Jan 21, 2022 8:24 pm
by Klaus
@Samuele,
this stack will do what you want, check the card script and the script of the image.
Best
Klaus