diff options
author | Nivesh Rajbhandari | 2012-04-04 17:24:27 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-04-04 17:24:27 -0700 |
commit | 01cf259da7aaa7d70789d9a7c32111d88b477463 (patch) | |
tree | 0bff3395ac681e5f685d2267f7dbc03a8e32bc4a /js/helper-classes/3D/snap-manager.js | |
parent | 331ea08655245e3532e48bf160d5f68a04d8723f (diff) | |
parent | 13368ca6ebbc13adeafccd898dfffd7ce37cb28a (diff) | |
download | ninja-01cf259da7aaa7d70789d9a7c32111d88b477463.tar.gz |
Merge branch 'refs/heads/ToolFixes' into WebGLMaterials
Conflicts:
js/document/templates/montage-html/default_html.css
js/mediators/element-mediator.js
js/panels/properties.reel/properties.js
js/tools/BrushTool.js
js/tools/LineTool.js
js/tools/PenTool.js
js/tools/SelectionTool.js
js/tools/ShapeTool.js
js/tools/TranslateObject3DTool.js
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/helper-classes/3D/snap-manager.js')
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index a755e9e2..a401c363 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js | |||
@@ -123,7 +123,8 @@ 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 | this.eventManager.addEventListener("elementReplaced", this, false); | ||
127 | } | 128 | } |
128 | }, | 129 | }, |
129 | 130 | ||
@@ -163,12 +164,26 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
163 | }, | 164 | }, |
164 | 165 | ||
165 | 166 | ||
166 | handleElementDeleted: { | 167 | handleElementsRemoved: { |
167 | value: function(event) { | 168 | value: function(event) { |
168 | this.removeElementFrom2DCache(event.detail); | 169 | var self = this, elements = event.detail; |
170 | |||
171 | if(Array.isArray(elements)) { | ||
172 | elements = Array.prototype.slice.call(elements, 0); | ||
173 | elements.forEach(function(element) { | ||
174 | self.removeElementFrom2DCache(element); | ||
175 | }); | ||
176 | } else { | ||
177 | this.removeElementFrom2DCache(elements); | ||
178 | } | ||
169 | } | 179 | } |
170 | }, | 180 | }, |
171 | 181 | ||
182 | handleElementReplaced: { | ||
183 | value: function(event) { | ||
184 | this._isCacheInvalid = true; | ||
185 | } | ||
186 | }, | ||
172 | 187 | ||
173 | setCurrentStage: { | 188 | setCurrentStage: { |
174 | value: function(stage) { | 189 | value: function(stage) { |
@@ -489,6 +504,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
489 | var n = this._elementCache.length; | 504 | var n = this._elementCache.length; |
490 | this._elementCache[index] = this._elementCache[n-1]; | 505 | this._elementCache[index] = this._elementCache[n-1]; |
491 | this._elementCache.pop(); | 506 | this._elementCache.pop(); |
507 | target.elementModel.isIn2DSnapCache = false; | ||
492 | found = true; | 508 | found = true; |
493 | } | 509 | } |
494 | 510 | ||
@@ -1411,6 +1427,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { | |||
1411 | case glObj.GEOM_TYPE_PATH: | 1427 | case glObj.GEOM_TYPE_PATH: |
1412 | // Snapping not implemented for these type, but don't throw an error... | 1428 | // Snapping not implemented for these type, but don't throw an error... |
1413 | break; | 1429 | break; |
1430 | case glObj.GEOM_TYPE_BRUSH_STROKE: | ||
1431 | break; //don't throw error because snapping not yet implemented | ||
1414 | case glObj.GEOM_TYPE_CUBIC_BEZIER: | 1432 | case glObj.GEOM_TYPE_CUBIC_BEZIER: |
1415 | { | 1433 | { |
1416 | var nearVrt = glObj.getNearVertex( eyePt, dir ); | 1434 | var nearVrt = glObj.getNearVertex( eyePt, dir ); |