diff options
Diffstat (limited to 'js/panels/css-panel')
-rw-r--r-- | js/panels/css-panel/styles-view-container.reel/styles-view-container.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/js/panels/css-panel/styles-view-container.reel/styles-view-container.js b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js index 6ce64b8f..a47b0db1 100644 --- a/js/panels/css-panel/styles-view-container.reel/styles-view-container.js +++ b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js | |||
@@ -14,6 +14,9 @@ exports.StylesViewContainer = Montage.create(Component, { | |||
14 | contentPanel : { | 14 | contentPanel : { |
15 | value: 'rules' | 15 | value: 'rules' |
16 | }, | 16 | }, |
17 | _lastSelection : { | ||
18 | value: null | ||
19 | }, | ||
17 | _hasStyles : { | 20 | _hasStyles : { |
18 | value: false | 21 | value: false |
19 | }, | 22 | }, |
@@ -59,6 +62,10 @@ exports.StylesViewContainer = Montage.create(Component, { | |||
59 | value: function() { | 62 | value: function() { |
60 | var elements = this.application.ninja.selectedElements; | 63 | var elements = this.application.ninja.selectedElements; |
61 | 64 | ||
65 | if(this._isSameArray(elements, this._lastSelection)) { console.log('new selection is identical');return false; } | ||
66 | |||
67 | this._lastSelection = elements; | ||
68 | |||
62 | if(elements.length === 0) { | 69 | if(elements.length === 0) { |
63 | this.hasStyles = false; | 70 | this.hasStyles = false; |
64 | return false; | 71 | return false; |
@@ -129,5 +136,16 @@ exports.StylesViewContainer = Montage.create(Component, { | |||
129 | this.selectionNameLabel.classList.add('no-styles'); | 136 | this.selectionNameLabel.classList.add('no-styles'); |
130 | } | 137 | } |
131 | } | 138 | } |
139 | }, | ||
140 | |||
141 | _isSameArray : { | ||
142 | value: function(left, right) { | ||
143 | if(!left || !right) { return false; } | ||
144 | if(left.length !== right.length) { return false; } | ||
145 | |||
146 | return left.every(function(item, i) { | ||
147 | return item === right[i]; | ||
148 | }); | ||
149 | } | ||
132 | } | 150 | } |
133 | }); \ No newline at end of file | 151 | }); \ No newline at end of file |