GWT : two DOM events on same div, priority and how to deactivate the second event when the first is called?
I've got a Widget which have two Dom mouseDown handlers :
First, I code with GWT but I think the problem is probably Javascript related.
One of this handler registration is defined in a class named Resizable which allows my widget to be resizable. The second handler registration is defined in a class named Draggable which allows my widget to be draggable.
So, in each constructor of these two classes (giving the widget in argument), I've got :
widget.addDomHandler(this, MouseDownEvent.getType());
I want to prioritize my dom event to force the Resizable handler to be called first and only after the Draggable handler. How can I achieve it ?
Moreover, I w开发者_运维技巧ant to stop the event if the resizable handler is called.
I tried the event.stopPropagation()
function but it seems that the event can only be stopped for parents and not for a similar event on the same widget.
How can I stop this event to avoid the draggable handler to be called if my widget is resizable ?
I precise that these two classes are completely independant as my widget can be Resizable but not Draggable, draggable and not resizable or both. So if I can, I want to avoid code intersection between these two classes.
Thanks
Did you try event.cancel()
instead of event.stopPropagation()
? That might help!
精彩评论