aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--js/helper-classes/3D/draw-utils.js7
-rw-r--r--js/mediators/element-mediator.js14
-rw-r--r--js/stage/layout.js17
3 files changed, 21 insertions, 17 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index 08a27618..c07391db 100644
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -110,6 +110,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
110 110
111 this.eventManager.addEventListener("elementAdded", this, false); 111 this.eventManager.addEventListener("elementAdded", this, false);
112 this.eventManager.addEventListener("elementDeleted", this, false); 112 this.eventManager.addEventListener("elementDeleted", this, false);
113 this.eventManager.addEventListener("deleteSelection", this, false);
113 this.eventManager.addEventListener("elementChange", this, false); 114 this.eventManager.addEventListener("elementChange", this, false);
114 } 115 }
115 }, 116 },
@@ -127,6 +128,12 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
127 } 128 }
128 }, 129 },
129 130
131 handleDeleteSelection: {
132 value: function(event) {
133 this.drawWorkingPlane();
134 }
135 },
136
130 _shouldUpdatePlanes: { 137 _shouldUpdatePlanes: {
131 value: function(props) { 138 value: function(props) {
132 if(!props) 139 if(!props)
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js
index b2bc5355..992ac620 100644
--- a/js/mediators/element-mediator.js
+++ b/js/mediators/element-mediator.js
@@ -44,12 +44,16 @@ exports.ElementMediator = Montage.create(NJComponent, {
44 this.deleteDelegate.handleDelete(); 44 this.deleteDelegate.handleDelete();
45 } else { 45 } else {
46 // Add the Undo/Redo 46 // Add the Undo/Redo
47 var els = []; 47 var els = [],
48 len = this.application.ninja.selectedElements.length;
48 49
49 if(this.application.ninja.selectedElements.length > 0) { 50 if(len) {
50 for(var i=0, item; item = this.application.ninja.selectedElements[i]; i++) { 51 for(var i = 0; i<len; i++)
51 ElementController.removeElement(item._element); 52 {
52 els.push(item._element); 53 els.push(this.application.ninja.selectedElements[i]);
54 }
55 for(i=0; i<len; i++) {
56 this._removeElement(els[i]._element);
53 } 57 }
54 58
55 NJevent( "deleteSelection", els ); 59 NJevent( "deleteSelection", els );
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