aboutsummaryrefslogtreecommitdiff
path: root/js/panels/properties.reel/sections/position-size.reel/position-size.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-06-13 13:56:56 -0700
committerValerio Virgillito2012-06-13 13:56:56 -0700
commit682f4917d6badd105998c3dd84d031c38b51f017 (patch)
tree7c907dd58e9b4f4a1d4802d8d22b9c84d3c2edf3 /js/panels/properties.reel/sections/position-size.reel/position-size.js
parenta827f2769d75848c0ba0bff03a927c1f2706322b (diff)
parent263ecfc95bd7eb5c726cd5688c3d74eb10296811 (diff)
downloadninja-682f4917d6badd105998c3dd84d031c38b51f017.tar.gz
Merge pull request #297 from mqg734/PI_HotTextFixes
Fixing properties panel to support px and % for body and other elements.
Diffstat (limited to 'js/panels/properties.reel/sections/position-size.reel/position-size.js')
-rwxr-xr-xjs/panels/properties.reel/sections/position-size.reel/position-size.js40
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 fef2b195..94c0bbf2 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
@@ -53,17 +53,33 @@ exports.PositionSize = Montage.create(Component, {
53 value: 0 53 value: 0
54 }, 54 },
55 55
56 leftUnits: {
57 value: "px"
58 },
59
56 topPosition: { 60 topPosition: {
57 value: 0 61 value: 0
58 }, 62 },
59 63
64 topUnits: {
65 value: "px"
66 },
67
60 heightSize: { 68 heightSize: {
61 value: 0 69 value: 0
62 }, 70 },
63 71
72 heightUnits: {
73 value: "px"
74 },
75
64 widthSize: { 76 widthSize: {
65 value: 0 77 value: 0
66 }, 78 },
79
80 widthUnits: {
81 value: "px"
82 },
67/* 83/*
68 widthSize: { 84 widthSize: {
69 get: function() { return this._widthSize;}, 85 get: function() { return this._widthSize;},
@@ -173,7 +189,7 @@ exports.PositionSize = Montage.create(Component, {
173 if(!event.wasSetByCode) { 189 if(!event.wasSetByCode) {
174 if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; 190 if(this.savedPosition) prevPosition = [this.savedPosition + "px"];
175 191
176 this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "left", [this.leftControl.value + "px"] , "Change", "pi", prevPosition); 192 this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "left", [this.leftControl.value + this.leftControl.units] , "Change", "pi", prevPosition);
177 this.savedPosition = null; 193 this.savedPosition = null;
178 } 194 }
179 } 195 }
@@ -186,7 +202,7 @@ exports.PositionSize = Montage.create(Component, {
186 if(!event.wasSetByCode) { 202 if(!event.wasSetByCode) {
187 if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; 203 if(this.savedPosition) prevPosition = [this.savedPosition + "px"];
188 204
189 this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "top", [this.topControl.value + "px"] , "Change", "pi", prevPosition); 205 this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "top", [this.topControl.value + this.topControl.units] , "Change", "pi", prevPosition);
190 this.savedPosition = null; 206 this.savedPosition = null;
191 } 207 }
192 } 208 }
@@ -197,7 +213,7 @@ exports.PositionSize = Montage.create(Component, {
197 var prevPosition, items; 213 var prevPosition, items;
198 214
199 if(!event.wasSetByCode) { 215 if(!event.wasSetByCode) {
200 if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; 216 if(this.savedPosition) prevPosition = [this.savedPosition];
201 217
202 this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; 218 this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot];
203 219
@@ -211,7 +227,7 @@ exports.PositionSize = Montage.create(Component, {
211 this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Change", "pi"); 227 this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Change", "pi");
212 } 228 }
213 229
214 this.application.ninja.elementMediator.setProperty(items, "height", [this.heightControl.value + "px"] , "Change", "pi", prevPosition); 230 this.application.ninja.elementMediator.setProperty(items, "height", [this.heightControl.value + this.heightControl.units] , "Change", "pi", prevPosition);
215 this.savedPosition = null; 231 this.savedPosition = null;
216 } 232 }
217 } 233 }
@@ -222,7 +238,7 @@ exports.PositionSize = Montage.create(Component, {
222 var prevPosition, items; 238 var prevPosition, items;
223 239
224 if(!event.wasSetByCode) { 240 if(!event.wasSetByCode) {
225 if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; 241 if(this.savedPosition) prevPosition = [this.savedPosition];
226 242
227 this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; 243 this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot];
228 244
@@ -237,7 +253,7 @@ exports.PositionSize = Montage.create(Component, {
237 253
238 } 254 }
239 255
240 this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + "px"] , "Change", "pi", prevPosition); 256 this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + this.widthControl.units] , "Change", "pi", prevPosition);
241 this.savedPosition = null; 257 this.savedPosition = null;
242 258
243 } 259 }
@@ -249,7 +265,7 @@ exports.PositionSize = Montage.create(Component, {
249 value: function(event) { 265 value: function(event) {
250 if(!event.wasSetByCode) { 266 if(!event.wasSetByCode) {
251 if(!this.savedPosition) this.savedPosition = this.leftPosition; 267 if(!this.savedPosition) this.savedPosition = this.leftPosition;
252 this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "left", [this.leftControl.value + "px"] , "Changing", "pi"); 268 this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "left", [this.leftControl.value + this.leftControl.units] , "Changing", "pi");
253 } 269 }
254 270
255 } 271 }
@@ -259,7 +275,7 @@ exports.PositionSize = Montage.create(Component, {
259 value: function(event) { 275 value: function(event) {
260 if(!event.wasSetByCode) { 276 if(!event.wasSetByCode) {
261 if(!this.savedPosition) this.savedPosition = this.topPosition; 277 if(!this.savedPosition) this.savedPosition = this.topPosition;
262 this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "top", [this.topControl.value + "px"] , "Changing", "pi"); 278 this.application.ninja.elementMediator.setProperty(this.application.ninja.selectedElements, "top", [this.topControl.value + this.topControl.units] , "Changing", "pi");
263 } 279 }
264 280
265 } 281 }
@@ -270,7 +286,7 @@ exports.PositionSize = Montage.create(Component, {
270 var items; 286 var items;
271 if(!event.wasSetByCode) { 287 if(!event.wasSetByCode) {
272 288
273 if(!this.savedPosition) this.savedPosition = this.heightSize; 289 if(!this.savedPosition) this.savedPosition = this.heightSize + " " + this.heightUnits;
274 290
275 this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; 291 this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot];
276 292
@@ -284,7 +300,7 @@ exports.PositionSize = Montage.create(Component, {
284 this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Changing", "pi"); 300 this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Changing", "pi");
285 } 301 }
286 302
287 this.application.ninja.elementMediator.setProperty(items, "height", [this.heightControl.value + "px"] , "Changing", "pi"); 303 this.application.ninja.elementMediator.setProperty(items, "height", [this.heightSize + this.heightUnits] , "Changing", "pi");
288 304
289 } 305 }
290 } 306 }
@@ -295,7 +311,7 @@ exports.PositionSize = Montage.create(Component, {
295 var items; 311 var items;
296 if(!event.wasSetByCode) { 312 if(!event.wasSetByCode) {
297 313
298 if(!this.savedPosition) this.savedPosition = this.widthSize; 314 if(!this.savedPosition) this.savedPosition = this.widthSize + " " + this.widthUnits;
299 315
300 this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot]; 316 this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.model.documentRoot];
301 317
@@ -308,7 +324,7 @@ exports.PositionSize = Montage.create(Component, {
308 this.application.ninja.elementMediator.setProperty(items, "height", [newHeight + "px"] , "Changing", "pi"); 324 this.application.ninja.elementMediator.setProperty(items, "height", [newHeight + "px"] , "Changing", "pi");
309 } 325 }
310 326
311 this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + "px"] , "Changing", "pi"); 327 this.application.ninja.elementMediator.setProperty(items, "width", [this.widthSize + this.widthUnits] , "Changing", "pi");
312 } 328 }
313 } 329 }
314 } 330 }