aboutsummaryrefslogtreecommitdiff
path: root/js/stage
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-03 15:09:54 -0800
committerNivesh Rajbhandari2012-02-03 15:09:54 -0800
commitd7ad2659d7ef8d0fffbb1cba8218061ebd516dd0 (patch)
treeefd2d3b7077fedfbf6234a92a223fee7a9a89244 /js/stage
parent130c1d3bfeedfc50ab3481c7d8c2e83af224feac (diff)
downloadninja-d7ad2659d7ef8d0fffbb1cba8218061ebd516dd0.tar.gz
Handle delete of multiple objects. Also, have deletion go through the mediator so elementDeleted event is fired for SnapManager, DrawUtils, etc. to clean up after deleted element(s).
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/stage')
-rw-r--r--js/stage/layout.js17
1 files changed, 5 insertions, 12 deletions
diff --git a/js/stage/layout.js b/js/stage/layout.js
index c369fc30..1a491210 100644
--- a/js/stage/layout.js
+++ b/js/stage/layout.js
@@ -58,7 +58,7 @@ exports.Layout = Montage.create(Component, {
58 58
59 this.eventManager.addEventListener("selectionChange", this, false); 59 this.eventManager.addEventListener("selectionChange", this, false);
60 60
61 this.eventManager.addEventListener("deleteSelection", this, true); 61 this.eventManager.addEventListener("deleteSelection", this, false);
62 62
63// this.addEventListener("change@stage.appModel.layoutView", this.handleLayoutView, false); 63// this.addEventListener("change@stage.appModel.layoutView", this.handleLayoutView, false);
64 64
@@ -83,21 +83,14 @@ exports.Layout = Montage.create(Component, {
83 handleElementDeleted: { 83 handleElementDeleted: {
84 value: function(event) { 84 value: function(event) {
85 this.domTree.splice(this.domTree.indexOf(event.detail), 1); 85 this.domTree.splice(this.domTree.indexOf(event.detail), 1);
86
87 this.draw();
88 this.draw3DInfo(false);
89 } 86 }
90 }, 87 },
91 88
92 captureDeleteSelection: { 89 // Redraw stage only once after all deletion is completed
90 handleDeleteSelection: {
93 value: function(event) { 91 value: function(event) {
94 //this.redrawDocument(); 92 this.draw();
95 93 this.draw3DInfo(false);
96 var len = event.detail.length;
97 for(var i = 0; i < len ; i++) {
98 this.domTree.splice(this.domTree.indexOf(event.detail[i]),1);
99 }
100
101 } 94 }
102 }, 95 },
103 96