aboutsummaryrefslogtreecommitdiff
path: root/js/panels/properties.reel/sections/position-size.reel/position-size.js
diff options
context:
space:
mode:
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.js81
1 files changed, 69 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..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
@@ -8,21 +8,78 @@ var Montage = require("montage/core/core").Montage;
8var Component = require("montage/ui/component").Component; 8var Component = require("montage/ui/component").Component;
9 9
10exports.PositionSize = Montage.create(Component, { 10exports.PositionSize = Montage.create(Component, {
11
12 position: {
13 value: null,
14 serializable: true
15 },
16
17 leftLabel: {
18 value: null,
19 serializable: true
20 },
21
22 leftControl: {
23 value: null,
24 serializable: true
25 },
26
27 topLabel: {
28 value: null,
29 serializable: true
30 },
31
32 topControl: {
33 value: null,
34 serializable: true
35 },
36
37 heightControl: {
38 value: null,
39 serializable: true
40 },
41
42 widthControl: {
43 value: null,
44 serializable: true
45 },
46
47 bindButton: {
48 value: null,
49 serializable: true
50 },
51
11 leftPosition: { 52 leftPosition: {
12 value: 0 53 value: 0
13 }, 54 },
14 55
56 leftUnits: {
57 value: "px"
58 },
59
15 topPosition: { 60 topPosition: {
16 value: 0 61 value: 0
17 }, 62 },
18 63
64 topUnits: {
65 value: "px"
66 },
67
19 heightSize: { 68 heightSize: {
20 value: 0 69 value: 0
21 }, 70 },
22 71
72 heightUnits: {
73 value: "px"
74 },
75
23 widthSize: { 76 widthSize: {
24 value: 0 77 value: 0
25 }, 78 },
79
80 widthUnits: {
81 value: "px"
82 },
26/* 83/*
27 widthSize: { 84 widthSize: {
28 get: function() { return this._widthSize;}, 85 get: function() { return this._widthSize;},
@@ -132,7 +189,7 @@ exports.PositionSize = Montage.create(Component, {
132 if(!event.wasSetByCode) { 189 if(!event.wasSetByCode) {
133 if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; 190 if(this.savedPosition) prevPosition = [this.savedPosition + "px"];
134 191
135 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);
136 this.savedPosition = null; 193 this.savedPosition = null;
137 } 194 }
138 } 195 }
@@ -145,7 +202,7 @@ exports.PositionSize = Montage.create(Component, {
145 if(!event.wasSetByCode) { 202 if(!event.wasSetByCode) {
146 if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; 203 if(this.savedPosition) prevPosition = [this.savedPosition + "px"];
147 204
148 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);
149 this.savedPosition = null; 206 this.savedPosition = null;
150 } 207 }
151 } 208 }
@@ -156,7 +213,7 @@ exports.PositionSize = Montage.create(Component, {
156 var prevPosition, items; 213 var prevPosition, items;
157 214
158 if(!event.wasSetByCode) { 215 if(!event.wasSetByCode) {
159 if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; 216 if(this.savedPosition) prevPosition = [this.savedPosition];
160 217
161 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];
162 219
@@ -170,7 +227,7 @@ exports.PositionSize = Montage.create(Component, {
170 this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Change", "pi"); 227 this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Change", "pi");
171 } 228 }
172 229
173 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);
174 this.savedPosition = null; 231 this.savedPosition = null;
175 } 232 }
176 } 233 }
@@ -181,7 +238,7 @@ exports.PositionSize = Montage.create(Component, {
181 var prevPosition, items; 238 var prevPosition, items;
182 239
183 if(!event.wasSetByCode) { 240 if(!event.wasSetByCode) {
184 if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; 241 if(this.savedPosition) prevPosition = [this.savedPosition];
185 242
186 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];
187 244
@@ -196,7 +253,7 @@ exports.PositionSize = Montage.create(Component, {
196 253
197 } 254 }
198 255
199 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);
200 this.savedPosition = null; 257 this.savedPosition = null;
201 258
202 } 259 }
@@ -208,7 +265,7 @@ exports.PositionSize = Montage.create(Component, {
208 value: function(event) { 265 value: function(event) {
209 if(!event.wasSetByCode) { 266 if(!event.wasSetByCode) {
210 if(!this.savedPosition) this.savedPosition = this.leftPosition; 267 if(!this.savedPosition) this.savedPosition = this.leftPosition;
211 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");
212 } 269 }
213 270
214 } 271 }
@@ -218,7 +275,7 @@ exports.PositionSize = Montage.create(Component, {
218 value: function(event) { 275 value: function(event) {
219 if(!event.wasSetByCode) { 276 if(!event.wasSetByCode) {
220 if(!this.savedPosition) this.savedPosition = this.topPosition; 277 if(!this.savedPosition) this.savedPosition = this.topPosition;
221 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");
222 } 279 }
223 280
224 } 281 }
@@ -229,7 +286,7 @@ exports.PositionSize = Montage.create(Component, {
229 var items; 286 var items;
230 if(!event.wasSetByCode) { 287 if(!event.wasSetByCode) {
231 288
232 if(!this.savedPosition) this.savedPosition = this.heightSize; 289 if(!this.savedPosition) this.savedPosition = this.heightSize + " " + this.heightUnits;
233 290
234 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];
235 292
@@ -243,7 +300,7 @@ exports.PositionSize = Montage.create(Component, {
243 this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Changing", "pi"); 300 this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Changing", "pi");
244 } 301 }
245 302