aboutsummaryrefslogtreecommitdiff
path: root/js/panels/properties/sections/three-d-view.reel/three-d-view.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/properties/sections/three-d-view.reel/three-d-view.js')
-rw-r--r--js/panels/properties/sections/three-d-view.reel/three-d-view.js63
1 files changed, 41 insertions, 22 deletions
diff --git a/js/panels/properties/sections/three-d-view.reel/three-d-view.js b/js/panels/properties/sections/three-d-view.reel/three-d-view.js
index 38dbb110..dda9f993 100644
--- a/js/panels/properties/sections/three-d-view.reel/three-d-view.js
+++ b/js/panels/properties/sections/three-d-view.reel/three-d-view.js
@@ -40,19 +40,16 @@ exports.ThreeD = Montage.create(Component, {
40 else 40 else
41 { 41 {
42 this.inGlobalMode = true; 42 this.inGlobalMode = true;
43 if(this.application.ninja.selectedElements.length) 43 var item = this.item;
44 if(item)
44 { 45 {
45 var item = this.application.ninja.selectedElements[0]._element; 46 this.x3D = item.elementModel.props3D.x3D;
46 if(item) 47 this.y3D = item.elementModel.props3D.y3D;
47 { 48 this.z3D = item.elementModel.props3D.z3D;
48 this.x3D = item.elementModel.props3D.x3D; 49
49 this.y3D = item.elementModel.props3D.y3D; 50 this.xAngle = item.elementModel.props3D.xAngle;
50 this.z3D = item.elementModel.props3D.z3D; 51 this.yAngle = item.elementModel.props3D.yAngle;
51 52 this.zAngle = item.elementModel.props3D.zAngle;
52 this.xAngle = item.elementModel.props3D.xAngle;
53 this.yAngle = item.elementModel.props3D.yAngle;
54 this.zAngle = item.elementModel.props3D.zAngle;
55 }
56 } 53 }
57 } 54 }
58 } 55 }
@@ -98,6 +95,10 @@ exports.ThreeD = Montage.create(Component, {
98 } 95 }
99 }, 96 },
100 97
98 item: {
99 value: null
100 },
101
101 handleChange: { 102 handleChange: {
102 value: function(event) { 103 value: function(event) {
103 if(event.wasSetByCode) { 104 if(event.wasSetByCode) {
@@ -106,7 +107,7 @@ exports.ThreeD = Montage.create(Component, {
106 107
107 this.apply3DProperties(event.currentTarget.identifier, 108 this.apply3DProperties(event.currentTarget.identifier,
108 event.currentTarget, 109 event.currentTarget,
109 this.application.ninja.selectedElements[0]._element, 110 this.item,
110 this.inGlobalMode, 111 this.inGlobalMode,
111 false); 112 false);
112 } 113 }
@@ -120,7 +121,7 @@ exports.ThreeD = Montage.create(Component, {
120 121
121 this.apply3DProperties(event.currentTarget.identifier, 122 this.apply3DProperties(event.currentTarget.identifier,
122 event.currentTarget, 123 event.currentTarget,
123 this.application.ninja.selectedElements[0]._element, 124 this.item,
124 this.inGlobalMode, 125 this.inGlobalMode,
125 true); 126 true);
126 } 127 }
@@ -128,9 +129,8 @@ exports.ThreeD = Montage.create(Component, {
128 129
129 apply3DProperties : { 130 apply3DProperties : {
130 value : function(prop, value, item, inGlobalMode, isChanging){ 131 value : function(prop, value, item, inGlobalMode, isChanging){
131 // TODO - May want to use mediator instead 132 var curMat = this.application.ninja.elementMediator.getMatrix(item);
132 var curMat = item.elementModel.props3D.matrix3d; 133 var delta = value.value - this.application.ninja.elementMediator.get3DProperty(item, prop);
133 var delta = value.value - item.elementModel.props3D[prop];
134 134
135 var xFormMat = Matrix.I(4); 135 var xFormMat = Matrix.I(4);
136 switch (prop) 136 switch (prop)
@@ -183,12 +183,31 @@ exports.ThreeD = Montage.create(Component, {
183 183
184 templateDidLoad : { 184 templateDidLoad : {
185 value: function() { 185 value: function() {
186 Object.defineBinding(this, "axisMode", { 186 Object.defineBinding(this, "axisMode", {
187 boundObject: this.axisModeGroupControl, 187 boundObject: this.axisModeGroupControl,
188 boundObjectPropertyPath: "selectedIndex", 188 boundObjectPropertyPath: "selectedIndex",
189 oneway: false 189 oneway: false
190 }); 190 });
191
192 Object.defineBinding(this, "item", {
193 boundObject: this,
194 boundObjectPropertyPath: "application.ninja.selectedElements",
195 boundValueMutator: this._getSelectedItem
196 });
197 }
198 },
191 199
200 _getSelectedItem: {
201 value: function(els)
202 {
203 if(els.length)
204 {
205 return els[0]._element || els[0];
206 }
207 else
208 {
209 return this.boundObject.application.ninja.currentDocument.documentRoot;
210 }
192 } 211 }
193 }, 212 },
194 213