From: Aleksander Ɓukasz Date: Thu, 1 Aug 2013 08:13:03 +0000 (+0200) Subject: Refactoring X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/d1363cb9ab794cf33c7d30cf15830857c8a9636c Refactoring --- diff --git a/modules/documentCanvas/canvas/canvas.js b/modules/documentCanvas/canvas/canvas.js index 6179b83..bd45273 100644 --- a/modules/documentCanvas/canvas/canvas.js +++ b/modules/documentCanvas/canvas/canvas.js @@ -321,16 +321,6 @@ $.extend(Canvas.prototype, { list: {}, - - - highlightElement: function(element) { - this.wrapper.find('.highlighted-element').removeClass('highlighted-element'); - element.dom().addClass('highlighted-element'); - }, - - dimElement: function(element) { - element.dom().removeClass('highlighted-element'); - }, getCurrentNodeElement: function() { return this.getDocumentElement(this.wrapper.find('.current-node-element')[0]); diff --git a/modules/documentCanvas/canvas/documentElement.js b/modules/documentCanvas/canvas/documentElement.js index d58d8c1..3601732 100644 --- a/modules/documentCanvas/canvas/documentElement.js +++ b/modules/documentCanvas/canvas/documentElement.js @@ -360,6 +360,10 @@ $.extend(DocumentNodeElement.prototype, { var displayCss = toggle ? 'inline-block' : 'none'; var label = this.dom().children('.canvas-widgets').find('.canvas-widget-label'); label.css('display', displayCss); + this.toggleHighlight(toggle); + }, + + toggleHighlight: function(toogle) { this.dom().toggleClass('highlighted-element'); } }); @@ -530,6 +534,10 @@ $.extend(DocumentTextElement.prototype, { this.after(newElement); newElement.after(rhsTextElement); return newElement; + }, + + toggleHighlight: function() { + // do nothing for now } }); diff --git a/modules/documentCanvas/documentCanvas.js b/modules/documentCanvas/documentCanvas.js index decda83..2f8dae5 100644 --- a/modules/documentCanvas/documentCanvas.js +++ b/modules/documentCanvas/documentCanvas.js @@ -55,10 +55,10 @@ return function(sandbox) { sandbox.publish('currentNodeElementChanged', currentNodeElement); }, highlightElement: function(element) { - canvas.highlightElement(element); + element.toggleHighlight(true); }, dimElement: function(element) { - canvas.dimElement(element); + element.toggleHighlight(false); }, jumpToElement: function(element) { canvas.setCurrentElement(element);