开发者

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜