From db0fa4e454b76d8a2bd6ba47c6f10166761179e7 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 4 Apr 2012 14:06:38 -0700 Subject: Adding replaceElement routine and event so Timeline can avoid removing and adding layers and PI and SelectionController can avoid deselecting and reselecting the element. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/snap-manager.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 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 9f6b9ed1..a401c363 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -124,6 +124,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { initialize: { value: function() { this.eventManager.addEventListener("elementsRemoved", this, false); + this.eventManager.addEventListener("elementReplaced", this, false); } }, @@ -170,15 +171,19 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { 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); + this.removeElementFrom2DCache(elements); } } }, + handleElementReplaced: { + value: function(event) { + this._isCacheInvalid = true; + } + }, setCurrentStage: { value: function(stage) { -- cgit v1.2.3