diff options
author | Ananya Sen | 2012-04-04 13:20:15 -0700 |
---|---|---|
committer | Ananya Sen | 2012-04-04 13:20:15 -0700 |
commit | 22ade57a30b45774882028eef4ab5a5bffe1a624 (patch) | |
tree | 52e589450eeb8adf7e11b66bd222fec5fa66c963 /js/helper-classes/3D/snap-manager.js | |
parent | bec4cde986975d1cc5f1d2791fdb18548fc2d72a (diff) | |
parent | 8482e23cd9b8c4700b5130f2588e5eb24d376536 (diff) | |
download | ninja-22ade57a30b45774882028eef4ab5a5bffe1a624.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Codeview-improvements
Diffstat (limited to 'js/helper-classes/3D/snap-manager.js')
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index a755e9e2..9f6b9ed1 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -123,7 +123,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
123 | /////////////////////////////////////////////////////////////////////// | 123 | /////////////////////////////////////////////////////////////////////// |
124 | initialize: { | 124 | initialize: { |
125 | value: function() { | 125 | value: function() { |
126 | this.eventManager.addEventListener("elementDeleted", this, false); | 126 | this.eventManager.addEventListener("elementsRemoved", this, false); |
127 | } | 127 | } |
128 | }, | 128 | }, |
129 | 129 | ||
@@ -163,9 +163,19 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
163 | }, | 163 | }, |
164 | 164 | ||
165 | 165 | ||
166 | handleElementDeleted: { | 166 | handleElementsRemoved: { |
167 | value: function(event) { | 167 | value: function(event) { |
168 | this.removeElementFrom2DCache(event.detail); | 168 | var self = this, elements = event.detail; |
169 | |||
170 | if(Array.isArray(elements)) { | ||
171 | elements = Array.prototype.slice.call(elements, 0); | ||
172 | elements.forEach(function(element) { | ||
173 | element = element._element || element; | ||
174 | self.removeElementFrom2DCache(element); | ||
175 | }); | ||
176 | } else { | ||
177 | this.removeElementFrom2DCache(elements._element || elements); | ||
178 | } | ||
169 | } | 179 | } |
170 | }, | 180 | }, |
171 | 181 | ||
@@ -489,6 +499,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
489 | var n = this._elementCache.length; | 499 | var n = this._elementCache.length; |
490 | this._elementCache[index] = this._elementCache[n-1]; | 500 | this._elementCache[index] = this._elementCache[n-1]; |
491 | this._elementCache.pop(); | 501 | this._elementCache.pop(); |
502 | target.elementModel.isIn2DSnapCache = false; | ||
492 | found = true; | 503 | found = true; |
493 | } | 504 | } |
494 | 505 | ||
@@ -1411,6 +1422,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1411 | case glObj.GEOM_TYPE_PATH: | 1422 | case glObj.GEOM_TYPE_PATH: |
1412 | // Snapping not implemented for these type, but don't throw an error... | 1423 | // Snapping not implemented for these type, but don't throw an error... |
1413 | break; | 1424 | break; |
1425 | case glObj.GEOM_TYPE_BRUSH_STROKE: | ||
1426 | break; //don't throw error because snapping not yet implemented | ||
1414 | case glObj.GEOM_TYPE_CUBIC_BEZIER: | 1427 | case glObj.GEOM_TYPE_CUBIC_BEZIER: |
1415 | { | 1428 | { |
1416 | var nearVrt = glObj.getNearVertex( eyePt, dir ); | 1429 | var nearVrt = glObj.getNearVertex( eyePt, dir ); |