aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
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/mediators
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/mediators')
-rw-r--r--js/mediators/element-mediator.js14
1 files changed, 9 insertions, 5 deletions
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 );