multiple mouse events are fired on mouse click

857 Views Asked by At

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.

A mouse click fired both 'mouseout', 'mouseenter' and finally '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.

1

There are 1 best solutions below

0
On

Try using dojo/mouse (http://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"