简体   繁体   English

单击鼠标时会触发多个鼠标事件

[英]multiple mouse events are fired on mouse click

I created a dojo graphic group and hooked couple of mouse events to it, but the mouseclick event fire all other mouse events, I haven't moved the mouse while clicking. 我创建了一个dojo图形组,并关联了几个鼠标事件,但是mouseclick事件触发了所有其他鼠标事件,单击时我没有移动鼠标。

A mouse click fired both ' mouseout ', ' mouseenter ' and finally ' mousedown '. 鼠标单击会同时触发“ mouseout ”,“ mouseenter ”和“ mousedown ”。

Anyone has any ideas? 有人有什么想法吗?

var group = surface.createGroup();
group.on("mousedown", function(e) { handle mouse click here });
group.on("mouseout", function(e) { handle mouse out here });
group.on("mouseenter", function(e) { handle mouse enter here });

UPDATE: I was recreating the graphic on the mouse enter and that caused all sorts of problems. 更新:我正在鼠标输入上重新创建图形,这引起了各种各样的问题。

Try using dojo/mouse ( http://livedocs.dojotoolkit.org/dojo/mouse ) : 尝试使用dojo/mousehttp://livedocs.dojotoolkit.org/dojo/mouse ):

var group = surface.createGroup();
group.on("mousedown", function(e) { handle mouse click here });
group.on(mouse.leave, function(e) { handle mouse out here });
group.on(mouse.enter, function(e) { handle mouse enter here });

I guess click should be better than mousedown as you wrote "handle mouse click here" 我猜click应该比mousedown更好,因为您编写了“在此处处理鼠标单击”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM