aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
authorhwc4872012-04-13 11:52:13 -0700
committerhwc4872012-04-13 11:52:13 -0700
commit4f2fb5764703cab4ce3ada719b1395ed1e2f3b7c (patch)
tree3dc2e3c5a041179eed38eab1a00f851554e50005 /js/mediators
parent521df0ed9242efff45715998837068c87aca7efd (diff)
parent4b900ea5cd6bb77eb30cec8c03b9ec9fa662c1e9 (diff)
downloadninja-4f2fb5764703cab4ce3ada719b1395ed1e2f3b7c.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Snapping_II
Conflicts: js/helper-classes/3D/view-utils.js js/panels/presets/animations-presets.reel/animations-presets.js js/panels/presets/style-presets.reel/style-presets.js js/panels/presets/transitions-presets.reel/transitions-presets.js js/tools/Translate3DToolBase.js
Diffstat (limited to 'js/mediators')
-rwxr-xr-xjs/mediators/element-mediator.js36
1 files changed, 26 insertions, 10 deletions
diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js
index 09f2aeed..a05ca631 100755
--- a/js/mediators/element-mediator.js
+++ b/js/mediators/element-mediator.js
@@ -28,16 +28,15 @@ exports.ElementMediator = Montage.create(Component, {
28 value: function(elements, rules, notify) { 28 value: function(elements, rules, notify) {
29 if(Array.isArray(elements)) { 29 if(Array.isArray(elements)) {
30 elements.forEach(function(element) { 30 elements.forEach(function(element) {
31 element = element;
32 ElementController.addElement(element, rules); 31 ElementController.addElement(element, rules);
32 if(element.elementModel && element.elementModel.props3D) {
33 element.elementModel.props3D.init(element, false);
34 }
33 }); 35 });
34 } else { 36 } else {
35 ElementController.addElement(elements, rules); 37 ElementController.addElement(elements, rules);
36 38 if(elements.elementModel && elements.elementModel.props3D) {
37 // TODO - Check with webgl branch - Props seem to be already there. 39 elements.elementModel.props3D.init(elements, false);
38 var prop3d = this.get3DProperties(elements);
39 if(prop3d) {
40 elements.elementModel.controller["set3DProperties"](elements, [prop3d], 0, true);
41 } 40 }
42 } 41 }
43 42
@@ -84,6 +83,23 @@ exports.ElementMediator = Montage.create(Component, {
84 } 83 }
85 }, 84 },
86 85
86 replaceElement: {
87 value: function(newChild, oldChild, notify) {
88
89 this.application.ninja.currentDocument.documentRoot.replaceChild(newChild, oldChild);
90
91 var undoLabel = "replace element";
92
93 document.application.undoManager.add(undoLabel, this.replaceElement, this, oldChild, newChild);
94
95 this.application.ninja.documentController.activeDocument.needsSave = true;
96
97 if(notify || notify === undefined) {
98 NJevent("elementReplaced", {type : "replaceElement", data: {"newChild": newChild, "oldChild": oldChild}});
99 }
100 }
101 },
102
87 getProperty: { 103 getProperty: {
88 value: function(el, prop, valueMutator) { 104 value: function(el, prop, valueMutator) {
89 if(!el.elementModel) { 105 if(!el.elementModel) {
@@ -248,7 +264,7 @@ exports.ElementMediator = Montage.create(Component, {
248 var el; 264 var el;
249 265
250 for(var i=0, item; item = els[i]; i++) { 266 for(var i=0, item; item = els[i]; i++) {
251 item.elementModel.controller["setProperty"](item, p, value[i]); 267 item.elementModel.controller["setProperty"](item, p, value[i], eventType, source);
252 } 268 }
253 269
254 NJevent("element" + eventType, {type : "setProperty", source: source, data: {"els": els, "prop": p, "value": value}, redraw: null}); 270 NJevent("element" + eventType, {type : "setProperty", source: source, data: {"els": els, "prop": p, "value": value}, redraw: null});
@@ -588,14 +604,14 @@ exports.ElementMediator = Montage.create(Component, {
588 }, 604 },
589 605
590 setMatrix: { 606 setMatrix: {
591 value: function(el, mat, isChanging) { 607 value: function(el, mat, isChanging, source) {
592 var dist = el.elementModel.controller["getPerspectiveDist"](el); 608 var dist = el.elementModel.controller["getPerspectiveDist"](el);
593 el.elementModel.controller["set3DProperties"](el, [{mat:mat, dist:dist}], 0, !isChanging); 609 el.elementModel.controller["set3DProperties"](el, [{mat:mat, dist:dist}], 0, !isChanging);
594 610
595 if(isChanging) { 611 if(isChanging) {
596 NJevent("elementChanging", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); 612 NJevent("elementChanging", {type : "setMatrix", source: source, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null});
597 } else { 613 } else {
598 NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); 614 NJevent("elementChange", {type : "setMatrix", source: source, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null});
599 } 615 }
600 } 616 }
601 }, 617 },