diff options
author | Nivesh Rajbhandari | 2012-06-12 15:13:09 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-06-12 15:13:09 -0700 |
commit | 509092ff335f74517a413cfb2deeb9d2de20f8e3 (patch) | |
tree | 86dddcb4b74f04c965da52180cab3c49529148cf /js/panels/properties.reel/sections/position-size.reel/position-size.js | |
parent | 6854a72504f57903bd5de003e377f2aefb02d0da (diff) | |
download | ninja-509092ff335f74517a413cfb2deeb9d2de20f8e3.tar.gz |
Fixing properties panel to support px and % for body and other elements.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/panels/properties.reel/sections/position-size.reel/position-size.js')
-rwxr-xr-x | js/panels/properties.reel/sections/position-size.reel/position-size.js | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/js/panels/properties.reel/sections/position-size.reel/position-size.js b/js/panels/properties.reel/sections/position-size.reel/position-size.js index 7c24e02a..d9fd629c 100755 --- a/js/panels/properties.reel/sections/position-size.reel/position-size.js +++ b/js/panels/properties.reel/sections/position-size.reel/position-size.js | |||
@@ -12,17 +12,33 @@ exports.PositionSize = Montage.create(Component, { | |||
12 | value: 0 | 12 | value: 0 |
13 | }, | 13 | }, |
14 | 14 | ||
15 | leftUnits: { | ||
16 | value: "px" | ||
17 | }, | ||
18 | |||
15 | topPosition: { | 19 | topPosition: { |
16 | value: 0 | 20 | value: 0 |
17 | }, | 21 | }, |
18 | 22 | ||
23 | topUnits: { | ||
24 | value: "px" | ||
25 | }, | ||
26 | |||
19 | heightSize: { | 27 | heightSize: { |
20 | value: 0 | 28 | value: 0 |
21 | }, | 29 | }, |
22 | 30 | ||
31 | heightUnits: { | ||
32 | value: "px" | ||
33 | }, | ||
34 | |||
23 | widthSize: { | 35 | widthSize: { |
24 | value: 0 | 36 | value: 0 |
25 | }, | 37 | }, |
38 | |||
39 | widthUnits: { | ||
40 | value: "px" | ||
41 | }, | ||
26 | /* | 42 | /* |
27 | widthSize: { | 43 | widthSize: { |
28 | get: function() { return this._widthSize;}, | 44 | get: function() { return this._widthSize;}, |
@@ -132,7 +148,7 @@ exports.PositionSize = Montage.create(Component, { | |||
132 | if(!event.wasSetByCode) { | 148 | if(!event.wasSetByCode) { |
133 | if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; | 149 | if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; |
134 | 150 | ||
135 | this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "left", [this.leftControl.value + "px"] , "Change", "pi", prevPosition); | 151 | this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "left", [this.leftControl.value + this.leftControl.units] , "Change", "pi", prevPosition); |
136 | this.savedPosition = null; | 152 | this.savedPosition = null; |
137 | } | 153 | } |
138 | } | 154 | } |
@@ -145,7 +161,7 @@ exports.PositionSize = Montage.create(Component, { | |||
145 | if(!event.wasSetByCode) { | 161 | if(!event.wasSetByCode) { |
146 | if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; | 162 | if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; |
147 | 163 | ||
148 | this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "top", [this.topControl.value + "px"] , "Change", "pi", prevPosition); | 164 | this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "top", [this.topControl.value + this.topControl.units] , "Change", "pi", prevPosition); |
149 | this.savedPosition = null; | 165 | this.savedPosition = null; |
150 | } | 166 | } |
151 | } | 167 | } |
@@ -156,7 +172,7 @@ exports.PositionSize = Montage.create(Component, { | |||
156 | var prevPosition, items; | 172 | var prevPosition, items; |
157 | 173 | ||
158 | if(!event.wasSetByCode) { | 174 | if(!event.wasSetByCode) { |
159 | if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; | 175 | if(this.savedPosition) prevPosition = [this.savedPosition]; |
160 | 176 | ||
161 | this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; | 177 | this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; |
162 | 178 | ||
@@ -170,7 +186,7 @@ exports.PositionSize = Montage.create(Component, { | |||
170 | this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Change", "pi"); | 186 | this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Change", "pi"); |
171 | } | 187 | } |
172 | 188 | ||
173 | this.application.ninja.elementMediator.setProperty(items, "height", [this.heightControl.value + "px"] , "Change", "pi", prevPosition); | 189 | this.application.ninja.elementMediator.setProperty(items, "height", [this.heightControl.value + this.heightControl.units] , "Change", "pi", prevPosition); |
174 | this.savedPosition = null; | 190 | this.savedPosition = null; |
175 | } | 191 | } |
176 | } | 192 | } |
@@ -181,7 +197,7 @@ exports.PositionSize = Montage.create(Component, { | |||
181 | var prevPosition, items; | 197 | var prevPosition, items; |
182 | 198 | ||
183 | if(!event.wasSetByCode) { | 199 | if(!event.wasSetByCode) { |
184 | if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; | 200 | if(this.savedPosition) prevPosition = [this.savedPosition]; |
185 | 201 | ||
186 | this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; | 202 | this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; |
187 | 203 | ||
@@ -196,7 +212,7 @@ exports.PositionSize = Montage.create(Component, { | |||
196 | 212 | ||
197 | } | 213 | } |
198 | 214 | ||
199 | this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + "px"] , "Change", "pi", prevPosition); | 215 | this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + this.widthControl.units] , "Change", "pi", prevPosition); |
200 | this.savedPosition = null; | 216 | this.savedPosition = null; |
201 | 217 | ||
202 | } | 218 | } |
@@ -208,7 +224,7 @@ exports.PositionSize = Montage.create(Component, { | |||
208 | value: function(event) { | 224 | value: function(event) { |
209 | if(!event.wasSetByCode) { | 225 | if(!event.wasSetByCode) { |
210 | if(!this.savedPosition) this.savedPosition = this.leftPosition; | 226 | if(!this.savedPosition) this.savedPosition = this.leftPosition; |
211 | this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "left", [this.leftControl.value + "px"] , "Changing", "pi"); | 227 | this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "left", [this.leftControl.value + this.leftControl.units] , "Changing", "pi"); |
212 | } | 228 | } |
213 | 229 | ||
214 | } | 230 | } |
@@ -218,7 +234,7 @@ exports.PositionSize = Montage.create(Component, { | |||
218 | value: function(event) { | 234 | value: function(event) { |
219 | if(!event.wasSetByCode) { | 235 | if(!event.wasSetByCode) { |
220 | if(!this.savedPosition) this.savedPosition = this.topPosition; | 236 | if(!this.savedPosition) this.savedPosition = this.topPosition; |
221 | this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "top", [this.topControl.value + "px"] , "Changing", "pi"); | 237 | this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "top", [this.topControl.value + this.topControl.units] , "Changing", "pi"); |
222 | } | 238 | } |
223 | 239 | ||
224 | } | 240 | } |
@@ -229,7 +245,7 @@ exports.PositionSize = Montage.create(Component, { | |||
229 | var items; | 245 | var items; |
230 | if(!event.wasSetByCode) { | 246 | if(!event.wasSetByCode) { |
231 | 247 | ||
232 | if(!this.savedPosition) this.savedPosition = this.heightSize; | 248 | if(!this.savedPosition) this.savedPosition = this.heightSize + " " + this.heightUnits; |
233 | 249 | ||
234 | this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; | 250 | this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; |
235 | 251 | ||
@@ -243,7 +259,7 @@ exports.PositionSize = Montage.create(Component, { | |||
243 | this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Changing", "pi"); | 259 | this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Changing", "pi"); |
244 | } | 260 | } |
245 | 261 | ||
246 | this.application.ninja.elementMediator.setProperty(items, "height", [this.heightControl.value + "px"] , "Changing", "pi"); | 262 | this.application.ninja.elementMediator.setProperty(items, "height", [this.heightSize + this.heightUnits] , "Changing", "pi"); |
247 | 263 | ||
248 | } | 264 | } |
249 | } | 265 | } |
@@ -254,7 +270,7 @@ exports.PositionSize = Montage.create(Component, { | |||
254 | var items; | 270 | var items; |
255 | if(!event.wasSetByCode) { | 271 | if(!event.wasSetByCode) { |
256 | 272 | ||
257 | if(!this.savedPosition) this.savedPosition = this.widthSize; | 273 | if(!this.savedPosition) this.savedPosition = this.widthSize + " " + this.widthUnits; |
258 | 274 | ||
259 | this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; | 275 | this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; |
260 | 276 | ||
@@ -267,7 +283,7 @@ exports.PositionSize = Montage.create(Component, { | |||
267 | this.application.ninja.elementMediator.setProperty(items, "height", [newHeight + "px"] , "Changing", "pi"); | 283 | this.application.ninja.elementMediator.setProperty(items, "height", [newHeight + "px"] , "Changing", "pi"); |
268 | } | 284 | } |
269 | 285 | ||
270 | this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + "px"] , "Changing", "pi"); | 286 | this.application.ninja.elementMediator.setProperty(items, "width", [this.widthSize + this.widthUnits] , "Changing", "pi"); |
271 | } | 287 | } |
272 | } | 288 | } |
273 | } | 289 | } |