Refactoring
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 1 Aug 2013 08:13:03 +0000 (10:13 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 5 Aug 2013 10:20:07 +0000 (12:20 +0200)
modules/documentCanvas/canvas/canvas.js
modules/documentCanvas/canvas/documentElement.js
modules/documentCanvas/documentCanvas.js

index 6179b83..bd45273 100644 (file)
@@ -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]);
index d58d8c1..3601732 100644 (file)
@@ -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
     }
 });
 
index decda83..2f8dae5 100644 (file)
@@ -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);