Elementa icon indicating copy to clipboard operation
Elementa copied to clipboard

Clicks are not detected outside of parents

Open Su386yt opened this issue 1 year ago • 3 comments

Describe the bug If you create an object that has a negative coordinate, or a coordinate outside the parent, the onMouseClick event will not trigger. onMouseEnter and onMouseLeave still trigger however.

To Reproduce Steps to reproduce the behavior:

  1. Create a parent object
  2. Create a child of the parent object, with a location outside the parent object
  3. Give the parent object an onMouseClick event

Expected behavior The click event should trigger (as does the onMouseEnter and onMouseLeave)

Su386yt avatar May 07 '24 00:05 Su386yt

This seems to be intended as click events are not propagated when the click is not within the components bounds. On the other hand, mouse movement related events aren't properly checked for bounding and always propagate. This sounds more like an issue with the mouse movement events rather than the clicked event.

Is there a particular use case for this that cannot be circumvented by designing the component hierarchy differently?

Sychic avatar Jun 21 '24 18:06 Sychic

Is there a particular use case for this that cannot be circumvented by designing the component hierarchy differently?

image

I personally encountered it here, where each of the announcements is a child of the previous, with the x set at 110.percent. This allows for the next announcement to be at the end of the wrapped text, no matter the size of the text. I don't exactly see how this could be possible, without doing something like previousAnnouncement.getBottom().pixels, but then the pixels don't automatically rescale

Su386yt avatar Jun 24 '24 04:06 Su386yt

Is there a particular use case for this that cannot be circumvented by designing the component hierarchy differently?

image

I personally encountered it here, where each of the announcements is a child of the previous, with the x set at 110.percent. This allows for the next announcement to be at the end of the wrapped text, no matter the size of the text. I don't exactly see how this could be possible, without doing something like previousAnnouncement.getBottom().pixels, but then the pixels don't automatically rescale

You should be able to create a container and then position each announcement using SiblingConstraint for Y.

Sychic avatar Jul 01 '24 01:07 Sychic

Although that wouldn't use percents tho. Could a possible change be letting sibling constraint have a percent parameter (if there isn't already)?

Su386yt avatar Jul 24 '24 23:07 Su386yt

Percents of what? You can always combine multiple constraints to achieve what you want.

Sychic avatar Jul 25 '24 00:07 Sychic

Percent of width or percent of height. From my understanding, the pad in the SiblingConstraint is the same as say 5.pixels. Is there any way to get the pad to do 5.percent?

Su386yt avatar Jul 25 '24 23:07 Su386yt

5 percent of what

Sychic avatar Jul 25 '24 23:07 Sychic

The parent component's width/height, same as if you were to do x = 5.percent

Su386yt avatar Jul 25 '24 23:07 Su386yt

I don't see why you couldn't? You'd basically just do SiblingConstraint() + 5.percent.

Sychic avatar Jul 25 '24 23:07 Sychic

Oh right! Thank you!

Su386yt avatar Jul 26 '24 00:07 Su386yt