diff options
author | Pushkar Joshi | 2012-02-02 11:28:45 -0800 |
---|---|---|
committer | Pushkar Joshi | 2012-02-02 11:28:45 -0800 |
commit | acc500d1f1c76f4e7c93ae1cfea8d925ca95e7b9 (patch) | |
tree | 877f8ca734228c11050b037ce82fc0d1e1303193 /js/panels/properties/sections/three-d-view.reel/three-d-view.js | |
parent | 4d4de64472603426a73b26cc98ba8206190949b8 (diff) | |
parent | 4222db97e353fb65fab787ba5927d16d9fa4e1f7 (diff) | |
download | ninja-acc500d1f1c76f4e7c93ae1cfea8d925ca95e7b9.tar.gz |
Merge branch 'working' of c:/Code/github/emueller/ninja-internal/ into pentool
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.js | 86 |
1 files changed, 64 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..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 | ||
223 | _getSelectedItem: { | ||
224 | value: function(els) | ||
225 | { | ||
226 | if(els.length) | ||
227 | { | ||
228 | return els[0]._element || els[0]; | ||
229 | } | ||
230 | else | ||
231 | { | ||
232 | return this.boundObject.application.ninja.currentDocument.documentRoot; | ||
233 | } | ||
192 | } | 234 | } |
193 | }, | 235 | }, |
194 | 236 | ||