avul-OS-unda
avul-OS-unda

Reputation: 167

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.

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.

Upvotes: 0

Views: 873

Answers (1)

ben
ben

Reputation: 3568

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"

Upvotes: 0

Related Questions