aboutsummaryrefslogtreecommitdiff
path: root/js/mediators/element-mediator.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/mediators/element-mediator.js')
-rw-r--r--js/mediators/element-mediator.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js
index 1d0aef44..9aefbca6 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 els.push(this.application.ninja.selectedElements[i]);
52 els.push(item._element); 53 }
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 );
@@ -108,6 +112,13 @@ exports.ElementMediator = Montage.create(NJComponent, {
108 } 112 }
109 }, 113 },
110 114
115 replaceElement: {
116 value: function(el, el2) {
117 el2.elementModel = el.elementModel;
118 this.application.ninja.currentDocument.documentRoot.replaceChild(el2, el);
119 }
120 },
121
111 getNJProperty: { 122 getNJProperty: {
112 value: function(el, p) { 123 value: function(el, p) {
113 if(el.elementModel) { 124 if(el.elementModel) {
@@ -425,7 +436,7 @@ exports.ElementMediator = Montage.create(NJComponent, {
425 el.elementModel.controller["set3DProperties"](el, props, i, update3DModel); 436 el.elementModel.controller["set3DProperties"](el, props, i, update3DModel);
426 } 437 }
427 438
428 NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": props, "value": props}, redraw: null}); 439 NJevent("element" + eventType, {type : "set3DProperties", source: source, data: {"els": els, "prop": "matrix", "value": props}, redraw: null});
429 } 440 }
430 }, 441 },
431 442
@@ -660,11 +671,11 @@ exports.ElementMediator = Montage.create(NJComponent, {
660 671
661 if(isChanging) 672 if(isChanging)
662 { 673 {
663 NJevent("elementChanging", {type : "setMatrix", source: null, data: {"el": el, "prop": "matrix", "value": mat}, redraw: null}); 674 NJevent("elementChanging", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null});
664 } 675 }
665 else 676 else
666 { 677 {
667 NJevent("elementChange", {type : "setMatrix", source: null, data: {"el": el, "prop": "matrix", "value": mat}, redraw: null}); 678 NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null});
668 } 679 }
669 } 680 }
670 }, 681 },