From a11ef2eed7049835c8bdfa50a2b893632c46eaa0 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 4 Apr 2012 11:11:58 -0700 Subject: Squashed commit of Preparing for the montage undo-manager: Architecture changes Reworked the add and remove elements into 1 function which can take 1 or more elements. Removed the _element from the selection array Many other changes related to those 2 changes Undo/Redo shortcuts are now using montage undo/redo manager. Signed-off-by: Valerio Virgillito --- js/helper-classes/3D/snap-manager.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'js/helper-classes/3D/snap-manager.js') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 5b467b41..67dedc49 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, { /////////////////////////////////////////////////////////////////////// initialize: { value: function() { - this.eventManager.addEventListener("elementDeleted", this, false); + this.eventManager.addEventListener("elementsRemoved", this, false); } }, @@ -163,9 +163,19 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { }, - handleElementDeleted: { + handleElementsRemoved: { value: function(event) { - this.removeElementFrom2DCache(event.detail); + var self = this, elements = event.detail; + + if(Array.isArray(elements)) { + elements = Array.prototype.slice.call(elements, 0); + elements.forEach(function(element) { + element = element._element || element; + self.removeElementFrom2DCache(element); + }); + } else { + this.removeElementFrom2DCache(elements._element || elements); + } } }, -- cgit v1.2.3 From f699c3b4a0b39263bc1113882c66fbe616b2a271 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 4 Apr 2012 11:31:26 -0700 Subject: Need to set elementModel.isIn2DSnapCache flag to false when removing element from SnapManager's cache. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/snap-manager.js | 1 + 1 file changed, 1 insertion(+) (limited to 'js/helper-classes/3D/snap-manager.js') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 67dedc49..9f6b9ed1 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -499,6 +499,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { var n = this._elementCache.length; this._elementCache[index] = this._elementCache[n-1]; this._elementCache.pop(); + target.elementModel.isIn2DSnapCache = false; found = true; } -- cgit v1.2.3