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/controllers/selection-controller.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'js/controllers/selection-controller.js') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index dbb3f30d..5665b09c 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -45,6 +45,7 @@ exports.SelectionController = Montage.create(Component, { this.eventManager.addEventListener("openDocument", this, false); this.eventManager.addEventListener("elementAdded", this, false); this.eventManager.addEventListener("elementsRemoved", this, false); + this.eventManager.addEventListener("elementReplaced", this, false); this.eventManager.addEventListener("selectAll", this, false); this.eventManager.addEventListener("switchDocument", this, false); this.eventManager.addEventListener("closeDocument", this, false); @@ -103,6 +104,12 @@ exports.SelectionController = Montage.create(Component, { } }, + handleElementReplaced: { + value: function(event) { + this.application.ninja.selectedElements[this.application.ninja.selectedElements.indexOf(event.detail.data.oldChild)] = event.detail.data.newChild; + } + }, + handleSelectAll: { value: function(event) { var selected = [], childNodes = []; -- cgit v1.2.3