diff options
author | Eric Guzman | 2012-05-10 16:33:12 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-10 16:33:12 -0700 |
commit | 7358c12a45ac2923e7553b17a1cc7c15af70e4c8 (patch) | |
tree | 7d863f469ee6dba4d7c663a136c9ab92f2f7db1b /js | |
parent | 835f4092e91a96d1fb208530ccdc154779c4fa8b (diff) | |
download | ninja-7358c12a45ac2923e7553b17a1cc7c15af70e4c8.tar.gz |
CSS Panel - Add work-around for selection change event.
Diffstat (limited to 'js')
-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 |