-
-
Notifications
You must be signed in to change notification settings - Fork 953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Top objects prevent events on the objects below them #238
Comments
No. You have no click on lower rectangle because it is UNDER the black rectangle. Clicking on red rectangle works just fine. |
I'm not subscribed on upper (black) rectangle clicks. Why it prevents clicks to pass through to lower layers then? If this is by design, then how the desired behavior can be achieved? I can't disable all events on the black rectangle, some of them are still needed. |
The behavior is exactly the same as for DOM elements and events.
Because you clicked on the top rectangle. It is like papers on a table. If you touch upper one, then you didn't touch lower one. You can disable all events from the top rectangle. So all events will go down to lower rect.
If you need to listen to events on lower rect you can manually check intersection of pointer position and lower rectangle. If they intersect - trigger you click function handler. |
That's right, the problem is that desktop frameworks do it differently, I expected at least a possibility to do something similar here. Calculating intersections could be a way to go, however in my case all the objects are spread across multiple layers according to this konva performance tip:
Is there a way of calculating intersection between two objects that belong to different layers? |
@EugeneSqr hard to say, because I don't see what exactly you want to achieve.
There is not built-in way to calculate the intersection between OBJECTS. |
The real scenario involves swiping instead of "mousemove" events in my example above. One should be able to swipe out all objects from a certain layer (or multiple layers) by applying swipe gesture on any part of the stage. The objects must stay clickable though. I place a transparent rectangle above all the layers and want it to react only on swipe gestures, letting all other events (especially clicks) pass through.
I'm sorry I confused your suggestion with the one in this issue
Sounds like I need to build my own event system. I'm going to give it a try if there is no other option. |
The problem looks similar to this one. However in my case objects listen for different types of events:
Capturing "mousemove" events on the upper rectangle prevents capturing "click" events on the lower rectangle. Please see this jsfiddle for better illustration of the problem.
Expected behavior: "mousemove" events on upper objects should not prevent "click" events on the objects below.
The text was updated successfully, but these errors were encountered: