hyperandroid / CAAT

Canvas Advanced Animation Toolkit
hyperandroid.github.com/CAAT
MIT License
727 stars 117 forks source link

Event bubbling #31

Closed hyperandroid closed 12 years ago

hyperandroid commented 12 years ago

Test the convenience of a consumed parameter to input events which will set the event as consumed or not. If the event is not consumed, the input subsystem will continue traversing the scene graph finding suitable actors to consume the event. Implications:

robboerman commented 12 years ago

Does this have to do with the following too?

I want to create an ActorContainer that can be dragged and that contains Actor children. The Actor children should respond to clicks. At the moment this is not possible. If the Actor has enabled events, all events stop at the actor and the Actor Container's mouseClick and mouseDrag callbacks are never called. Another example is when a Actor Container contains Actors that have events disabled. The events again stop at the actor because the Actor has mouseEnabled set to false.

hyperandroid commented 12 years ago

Yes. With the possibility of programmatically let the input traversal function to find other suitable actors to receive the input event. Will make some tests to realize whether it is suitable to be added to caat or not.

robboerman commented 12 years ago

What is also possible is a manual bubble to parents. At the moment Actors contain all mouse handler stubs. That stub could also do a call on the object's parent (mouseDown: function(eventObject) {if (this.parent.mouseEnabled) this.parent.mouseDown.call(eventObject);} That way you would not have to change anything in the findActor part but just let actors that are found pass the event along

(don't know exactly if this works with the mouse coordinates though)

blake8086 commented 12 years ago

This would be great, I'm having an issue with this right now (I want to be able to drag the mouse with the button held down over multiple Actors and have them all notice).

hyperandroid commented 12 years ago

CAAT 0.3 build 208.