diff options
author | Ananya Sen | 2012-04-17 18:11:55 -0700 |
---|---|---|
committer | Ananya Sen | 2012-04-17 18:11:55 -0700 |
commit | 35abad196cc9feb76ef50c1b63032a38233a6d51 (patch) | |
tree | 914689c66d4ab6c6e088b571eade0a0e35082916 /js/helper-classes/3D/draw-utils.js | |
parent | 1f891c58bad0b7746659aa4138001b5ee76d9a0e (diff) | |
parent | 616a8532099fec2a15855eac97cd85cb60c4451c (diff) | |
download | ninja-35abad196cc9feb76ef50c1b63032a38233a6d51.tar.gz |
Merge branch 'refs/heads/ninja-internal-master' into Codeview-improvements
Diffstat (limited to 'js/helper-classes/3D/draw-utils.js')
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js index c7c1c08d..a5428ea3 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -112,6 +112,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
112 | this.eventManager.addEventListener("elementsRemoved", this, false); | 112 | this.eventManager.addEventListener("elementsRemoved", this, false); |
113 | this.eventManager.addEventListener("elementChange", this, false); | 113 | this.eventManager.addEventListener("elementChange", this, false); |
114 | this.eventManager.addEventListener("closeDocument", this, false); | 114 | this.eventManager.addEventListener("closeDocument", this, false); |
115 | this.eventManager.addEventListener("elementReplaced", this, false); | ||
115 | } | 116 | } |
116 | }, | 117 | }, |
117 | 118 | ||
@@ -170,13 +171,41 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
170 | this.removeElement(element); | 171 | this.removeElement(element); |
171 | }, this); | 172 | }, this); |
172 | } else { | 173 | } else { |
173 | this.removeElement(elements._element || elements); | 174 | this.removeElement(elements); |
174 | } | 175 | } |
175 | 176 | ||
176 | this.drawWorkingPlane(); | 177 | this.drawWorkingPlane(); |
177 | } | 178 | } |
178 | }, | 179 | }, |
179 | 180 | ||
181 | handleElementReplaced: { | ||
182 | value: function(event) { | ||
183 | var oldElement = event.detail.data.oldChild; | ||
184 | var newElement = event.detail.data.newChild; | ||
185 | |||
186 | // check if we already know about this object | ||
187 | var n = this._eltArray.length, | ||
188 | plane; | ||
189 | for (var i=0; i<n; i++) { | ||
190 | if (oldElement === this._eltArray[i]) { | ||
191 | this._eltArray[i] = newElement; | ||
192 | plane = this._planesArray[i]; | ||
193 | break; | ||
194 | } | ||
195 | } | ||
196 | |||
197 | if(!plane) { | ||
198 | this._eltArray.push( newElement ); | ||
199 | plane = Object.create(this.ElementPlanes, {}); | ||
200 | this._planesArray.push( plane ); | ||
201 | } | ||
202 | |||
203 | plane.setElement( newElement ); | ||
204 | plane.init(); | ||
205 | newElement.elementModel.props3D.elementPlane = plane; | ||
206 | } | ||
207 | }, | ||
208 | |||
180 | _shouldUpdatePlanes: { | 209 | _shouldUpdatePlanes: { |
181 | value: function(props) { | 210 | value: function(props) { |
182 | if(!props) { | 211 | if(!props) { |