From: Aleksander Ɓukasz Date: Mon, 10 Jun 2013 09:45:32 +0000 (+0200) Subject: Fixing event handling in documentCanvas module X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/64bdf1aaa07bd683a71241e18e6e26200a481bab Fixing event handling in documentCanvas module Propagation caused handling the event multiple times for each parent of the wlxml node. --- diff --git a/modules/documentCanvas/documentCanvas.js b/modules/documentCanvas/documentCanvas.js index ea44955..f7d7fd0 100644 --- a/modules/documentCanvas/documentCanvas.js +++ b/modules/documentCanvas/documentCanvas.js @@ -20,9 +20,16 @@ return function(sandbox) { sandbox.publish('contentChanged'); }); - this.node.on('mouseover', '[wlxml-tag]', function(e) { sandbox.publish('nodeHovered', $(e.target)); }); - this.node.on('mouseout', '[wlxml-tag]', function(e) { sandbox.publish('nodeBlured', $(e.target)); }); + this.node.on('mouseover', '[wlxml-tag]', function(e) { + e.stopPropagation(); + sandbox.publish('nodeHovered', $(e.target)); + }); + this.node.on('mouseout', '[wlxml-tag]', function(e) { + e.stopPropagation(); + sandbox.publish('nodeBlured', $(e.target)); + }); this.node.on('click', '[wlxml-tag]', function(e) { + e.stopPropagation(); console.log('clicked node type: '+e.target.nodeType); view._markSelected($(e.target)); });