diff options
author | Eric Guzman | 2012-05-21 17:04:23 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-21 17:04:23 -0700 |
commit | b5bbf69e59dbadf6504955875cc13d893efe3259 (patch) | |
tree | c1818089c8fdc790dc17fa55acb61595f8efea0a /js/panels/css-panel/rule-list-container.reel | |
parent | 022164517cafa5f75f6d3e5eed250ae1500f898a (diff) | |
download | ninja-b5bbf69e59dbadf6504955875cc13d893efe3259.tar.gz |
Rule List Container - Handle drawing multiple rules at the same time
Fixes problems when dropping multiple images on to stage and the selection changes too quickly
Diffstat (limited to 'js/panels/css-panel/rule-list-container.reel')
-rw-r--r-- | js/panels/css-panel/rule-list-container.reel/rule-list-container.js | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/js/panels/css-panel/rule-list-container.reel/rule-list-container.js b/js/panels/css-panel/rule-list-container.reel/rule-list-container.js index e7174c3d..e2e269ba 100644 --- a/js/panels/css-panel/rule-list-container.reel/rule-list-container.js +++ b/js/panels/css-panel/rule-list-container.reel/rule-list-container.js | |||
@@ -78,8 +78,6 @@ exports.RuleListContainer = Montage.create(Component, { | |||
78 | rules, ruleListLog; | 78 | rules, ruleListLog; |
79 | 79 | ||
80 | rules = this.getRulesForSelection(selection); | 80 | rules = this.getRulesForSelection(selection); |
81 | |||
82 | this._instanceToAdd = instance; | ||
83 | instance.rules = rules; | 81 | instance.rules = rules; |
84 | 82 | ||
85 | ruleListLog = { | 83 | ruleListLog = { |
@@ -88,13 +86,22 @@ exports.RuleListContainer = Montage.create(Component, { | |||
88 | }; | 86 | }; |
89 | 87 | ||
90 | this.ruleLists.push(ruleListLog); | 88 | this.ruleLists.push(ruleListLog); |
91 | this._appendElement = container; | 89 | |
90 | this.ruleListsToDraw.push({ | ||
91 | element : container, | ||
92 | component : instance | ||
93 | }); | ||
94 | |||
92 | this.needsDraw = true; | 95 | this.needsDraw = true; |
93 | 96 | ||
94 | return ruleListLog; | 97 | return ruleListLog; |
95 | } | 98 | } |
96 | }, | 99 | }, |
97 | 100 | ||
101 | ruleListsToDraw : { | ||
102 | value: [] | ||
103 | }, | ||
104 | |||
98 | getRulesForSelection : { | 105 | getRulesForSelection : { |
99 | value: function(selection) { | 106 | value: function(selection) { |
100 | var rules; | 107 | var rules; |
@@ -141,23 +148,28 @@ exports.RuleListContainer = Montage.create(Component, { | |||
141 | } | 148 | } |
142 | }, | 149 | }, |
143 | 150 | ||
144 | draw : { | 151 | willDraw : { |
145 | value: function() { | 152 | value: function() { |
146 | if(this._appendElement) { | 153 | //// hide all rule lists |
147 | this.element.appendChild(this._appendElement); | 154 | this.ruleLists.forEach(function(ruleListDescriptor) { |
148 | this._instanceToAdd.element = this._appendElement; | 155 | ruleListDescriptor.component.hide = true; |
149 | this._appendElement = null; | 156 | }); |
150 | this.needsDraw = true; | ||
151 | return; | ||
152 | } | ||
153 | 157 | ||
154 | if(this._lastDisplayedList) { | 158 | if(this.displayedList) { |
155 | this._lastDisplayedList.component.element.style.display = 'none'; | 159 | this.displayedList.component.hide = false; |
156 | if(this._displayedList.component.element) { | ||
157 | this._displayedList.component.element.style.display = null; | ||
158 | } | ||
159 | } | 160 | } |
160 | } | 161 | } |
162 | }, | ||
163 | |||
164 | draw : { | ||
165 | value: function() { | ||
166 | this.ruleListsToDraw.forEach(function(ruleListDescriptor) { | ||
167 | this.element.appendChild(ruleListDescriptor.element); | ||
168 | ruleListDescriptor.component.element = ruleListDescriptor.element; | ||
169 | ruleListDescriptor.component.needsDraw = true; | ||
170 | }, this); | ||
171 | this.ruleListsToDraw.length = 0; | ||
172 | } | ||
161 | 173 | ||
162 | }, | 174 | }, |
163 | 175 | ||