aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-04-04 14:06:38 -0700
committerNivesh Rajbhandari2012-04-04 14:06:38 -0700
commitdb0fa4e454b76d8a2bd6ba47c6f10166761179e7 (patch)
treead28f7324d2d08163247e9be8f0982d6739e5eaf /js/controllers
parent8482e23cd9b8c4700b5130f2588e5eb24d376536 (diff)
downloadninja-db0fa4e454b76d8a2bd6ba47c6f10166761179e7.tar.gz
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 <mqg734@motorola.com>
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/elements/shapes-controller.js8
-rwxr-xr-xjs/controllers/selection-controller.js7
2 files changed, 9 insertions, 6 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index c9164e3e..e792c646 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -73,12 +73,8 @@ exports.ShapesController = Montage.create(CanvasController, {
73 canvas.width = el.width; 73 canvas.width = el.width;
74 canvas.height = el.height; 74 canvas.height = el.height;
75 canvas.elementModel = el.elementModel; 75 canvas.elementModel = el.elementModel;
76 this.application.ninja.currentDocument.documentRoot.replaceChild(canvas, el); 76 this.toggleWebGlMode(canvas, value);
77 NJevent("elementsRemoved", el); 77 this.application.ninja.elementMediator.replaceElement(canvas, el);
78 el = canvas;
79 this.toggleWebGlMode(el, value);
80 el.elementModel.shapeModel.GLWorld.render();
81 this.application.ninja.selectionController.selectElement(el);
82 return; 78 return;
83 case "strokeMaterial": 79 case "strokeMaterial":
84 var sm = Object.create(MaterialsModel.getMaterial(value)); 80 var sm = Object.create(MaterialsModel.getMaterial(value));
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, {
45 this.eventManager.addEventListener("openDocument", this, false); 45 this.eventManager.addEventListener("openDocument", this, false);
46 this.eventManager.addEventListener("elementAdded", this, false); 46 this.eventManager.addEventListener("elementAdded", this, false);
47 this.eventManager.addEventListener("elementsRemoved", this, false); 47 this.eventManager.addEventListener("elementsRemoved", this, false);
48 this.eventManager.addEventListener("elementReplaced", this, false);
48 this.eventManager.addEventListener("selectAll", this, false); 49 this.eventManager.addEventListener("selectAll", this, false);
49 this.eventManager.addEventListener("switchDocument", this, false); 50 this.eventManager.addEventListener("switchDocument", this, false);
50 this.eventManager.addEventListener("closeDocument", this, false); 51 this.eventManager.addEventListener("closeDocument", this, false);
@@ -103,6 +104,12 @@ exports.SelectionController = Montage.create(Component, {
103 } 104 }
104 }, 105 },
105 106
107 handleElementReplaced: {
108 value: function(event) {
109 this.application.ninja.selectedElements[this.application.ninja.selectedElements.indexOf(event.detail.data.oldChild)] = event.detail.data.newChild;
110 }
111 },
112
106 handleSelectAll: { 113 handleSelectAll: {
107 value: function(event) { 114 value: function(event) {
108 var selected = [], childNodes = []; 115 var selected = [], childNodes = [];