From 64bdf1aaa07bd683a71241e18e6e26200a481bab Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 10 Jun 2013 11:45:32 +0200 Subject: [PATCH] Fixing event handling in documentCanvas module Propagation caused handling the event multiple times for each parent of the wlxml node. --- modules/documentCanvas/documentCanvas.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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)); }); -- 2.20.1