aboutsummaryrefslogtreecommitdiff
path: root/js/panels/properties/sections/three-d-view.reel
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/properties/sections/three-d-view.reel')
-rw-r--r--js/panels/properties/sections/three-d-view.reel/three-d-view.html12
-rw-r--r--js/panels/properties/sections/three-d-view.reel/three-d-view.js86
2 files changed, 70 insertions, 28 deletions
diff --git a/js/panels/properties/sections/three-d-view.reel/three-d-view.html b/js/panels/properties/sections/three-d-view.reel/three-d-view.html
index 1e24cb55..11a5b3f2 100644
--- a/js/panels/properties/sections/three-d-view.reel/three-d-view.html
+++ b/js/panels/properties/sections/three-d-view.reel/three-d-view.html
@@ -39,7 +39,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
39 "value": { 39 "value": {
40 "boundObject": {"@": "owner"}, 40 "boundObject": {"@": "owner"},
41 "boundObjectPropertyPath": "x3D", 41 "boundObjectPropertyPath": "x3D",
42 "oneway": false 42 "oneway": true
43 } 43 }
44 }, 44 },
45 "listeners": [ 45 "listeners": [
@@ -68,7 +68,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
68 "value": { 68 "value": {
69 "boundObject": {"@": "owner"}, 69 "boundObject": {"@": "owner"},
70 "boundObjectPropertyPath": "y3D", 70 "boundObjectPropertyPath": "y3D",
71 "oneway": false 71 "oneway": true
72 } 72 }
73 }, 73 },
74 "listeners": [ 74 "listeners": [
@@ -97,7 +97,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
97 "value": { 97 "value": {
98 "boundObject": {"@": "owner"}, 98 "boundObject": {"@": "owner"},
99 "boundObjectPropertyPath": "z3D", 99 "boundObjectPropertyPath": "z3D",
100 "oneway": false 100 "oneway": true
101 } 101 }
102 }, 102 },
103 "listeners": [ 103 "listeners": [
@@ -128,7 +128,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
128 "value": { 128 "value": {
129 "boundObject": {"@": "owner"}, 129 "boundObject": {"@": "owner"},
130 "boundObjectPropertyPath": "xAngle", 130 "boundObjectPropertyPath": "xAngle",
131 "oneway": false 131 "oneway": true
132 } 132 }
133 }, 133 },
134 "listeners": [ 134 "listeners": [
@@ -159,7 +159,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
159 "value": { 159 "value": {
160 "boundObject": {"@": "owner"}, 160 "boundObject": {"@": "owner"},
161 "boundObjectPropertyPath": "yAngle", 161 "boundObjectPropertyPath": "yAngle",
162 "oneway": false 162 "oneway": true
163 } 163 }
164 }, 164 },
165 "listeners": [ 165 "listeners": [
@@ -190,7 +190,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
190 "value": { 190 "value": {
191 "boundObject": {"@": "owner"}, 191 "boundObject": {"@": "owner"},
192 "boundObjectPropertyPath": "zAngle", 192 "boundObjectPropertyPath": "zAngle",
193 "oneway": false 193 "oneway": true
194 } 194 }
195 }, 195 },
196 "listeners": [ 196 "listeners": [
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..96053490 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,18 @@ exports.ThreeD = Montage.create(Component, {
98 } 95 }
99 }, 96 },
100 97
98 item: {
99 value: null
100 },
101
102 _curMat: {
103 value: null
104 },
105
106 _curProp: {
107 value: null
108 },
109
101 handleChange: { 110 handleChange: {
102 value: function(event) { 111 value: function(event) {
103 if(event.wasSetByCode) { 112 if(event.wasSetByCode) {
@@ -106,9 +115,12 @@ exports.ThreeD = Montage.create(Component, {
106 115
107 this.apply3DProperties(event.currentTarget.identifier, 116 this.apply3DProperties(event.currentTarget.identifier,
108 event.currentTarget, 117 event.currentTarget,
109 this.application.ninja.selectedElements[0]._element, 118 this.item,
110 this.inGlobalMode, 119 this.inGlobalMode,
111 false); 120 false);
121
122 this._curMat = null;
123 this._curProp = null;
112 } 124 }
113 }, 125 },
114 126
@@ -120,7 +132,7 @@ exports.ThreeD = Montage.create(Component, {
120 132
121 this.apply3DProperties(event.currentTarget.identifier, 133 this.apply3DProperties(event.currentTarget.identifier,
122 event.currentTarget, 134 event.currentTarget,
123 this.application.ninja.selectedElements[0]._element, 135 this.item,
124 this.inGlobalMode, 136 this.inGlobalMode,
125 true); 137 true);
126 } 138 }
@@ -128,9 +140,20 @@ exports.ThreeD = Montage.create(Component, {
128 140
129 apply3DProperties : { 141 apply3DProperties : {
130 value : function(prop, value, item, inGlobalMode, isChanging){ 142 value : function(prop, value, item, inGlobalMode, isChanging){
131 // TODO - May want to use mediator instead 143 if(!this._curMat)
132 var curMat = item.elementModel.props3D.matrix3d; 144 {
133 var delta = value.value - item.elementModel.props3D[prop]; 145 this._curMat = this.application.ninja.elementMediator.getMatrix(item);
146 }
147 var curMat = this._curMat;
148 var delta = value.value;
149 if(inGlobalMode)
150 {
151 if(!this._curProp)
152 {
153 this._curProp = this.application.ninja.elementMediator.get3DProperty(item, prop);
154 }
155 delta -= this._curProp;
156 }
134 157
135 var xFormMat = Matrix.I(4); 158 var xFormMat = Matrix.I(4);
136 switch (prop) 159 switch (prop)
@@ -183,12 +206,31 @@ exports.ThreeD = Montage.create(Component, {
183 206
184 templateDidLoad : { 207 templateDidLoad : {
185 value: function() { 208 value: function() {
186 Object.defineBinding(this, "axisMode", { 209 Object.defineBinding(this, "axisMode", {
187 boundObject: this.axisModeGroupControl, 210 boundObject: this.axisModeGroupControl,
188 boundObjectPropertyPath: "selectedIndex", 211 boundObjectPropertyPath: "selectedIndex",
189 oneway: false 212 oneway: false
190 }); 213 });
214
215 Object.defineBinding(this, "item", {
216 boundObject: this,
217 boundObjectPropertyPath: "application.ninja.selectedElements",
218 boundValueMutator: this._getSelectedItem
219 });
220 }
221 },
191 222