diff options
Diffstat (limited to 'js/panels/properties.reel/sections')
3 files changed, 47 insertions, 15 deletions
diff --git a/js/panels/properties.reel/sections/custom.reel/custom.js b/js/panels/properties.reel/sections/custom.reel/custom.js index 9df16112..c599dcb0 100755 --- a/js/panels/properties.reel/sections/custom.reel/custom.js +++ b/js/panels/properties.reel/sections/custom.reel/custom.js | |||
@@ -233,6 +233,12 @@ exports.CustomSection = Montage.create(Component, { | |||
233 | boundObjectPropertyPath: "value" | 233 | boundObjectPropertyPath: "value" |
234 | }); | 234 | }); |
235 | 235 | ||
236 | //Bind object value to controls list so it can be manipulated | ||
237 | Object.defineBinding(this.controls, aField.id + "Units", { | ||
238 | boundObject: obj, | ||
239 | boundObjectPropertyPath: "units" | ||
240 | }); | ||
241 | |||
236 | return obj; | 242 | return obj; |
237 | } | 243 | } |
238 | }, | 244 | }, |
diff --git a/js/panels/properties.reel/sections/position-size.reel/position-size.html b/js/panels/properties.reel/sections/position-size.reel/position-size.html index 5d1a805a..bc93da33 100755 --- a/js/panels/properties.reel/sections/position-size.reel/position-size.html +++ b/js/panels/properties.reel/sections/position-size.reel/position-size.html | |||
@@ -29,9 +29,12 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
29 | "properties": { | 29 | "properties": { |
30 | "element": {"#": "PosX"}, | 30 | "element": {"#": "PosX"}, |
31 | "maxValue": 10000, | 31 | "maxValue": 10000, |
32 | "minValue": -10000 | 32 | "minValue": -10000, |
33 | "acceptableUnits" : ["px", "%"], | ||
34 | "units": "px" | ||
33 | }, | 35 | }, |
34 | "bindings": { | 36 | "bindings": { |
37 | "units": {"<<->": "@owner.leftUnits"}, | ||
35 | "value": {"<<->": "@owner.leftPosition"} | 38 | "value": {"<<->": "@owner.leftPosition"} |
36 | } | 39 | } |
37 | }, | 40 | }, |
@@ -40,9 +43,12 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
40 | "properties": { | 43 | "properties": { |
41 | "element": {"#": "PosY"}, | 44 | "element": {"#": "PosY"}, |
42 | "maxValue": 10000, | 45 | "maxValue": 10000, |
43 | "minValue": -10000 | 46 | "minValue": -10000, |
47 | "acceptableUnits" : ["px", "%"], | ||
48 | "units": "px" | ||
44 | }, | 49 | }, |
45 | "bindings": { | 50 | "bindings": { |
51 | "units": {"<<->": "@owner.topUnits"}, | ||
46 | "value": {"<<->": "@owner.topPosition"} | 52 | "value": {"<<->": "@owner.topPosition"} |
47 | } | 53 | } |
48 | }, | 54 | }, |
@@ -50,9 +56,12 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
50 | "PosH": { | 56 | "PosH": { |
51 | "prototype": "js/components/hottextunit.reel[HotTextUnit]", | 57 | "prototype": "js/components/hottextunit.reel[HotTextUnit]", |
52 | "properties": { | 58 | "properties": { |
53 | "element": {"#": "PosH"} | 59 | "element": {"#": "PosH"}, |
60 | "acceptableUnits" : ["px", "%"], | ||
61 | "units": "px" | ||
54 | }, | 62 | }, |
55 | "bindings": { | 63 | "bindings": { |
64 | "units": {"<<->": "@owner.heightUnits"}, | ||
56 | "value": {"<<->": "@owner.heightSize"} | 65 | "value": {"<<->": "@owner.heightSize"} |
57 | } | 66 | } |
58 | }, | 67 | }, |
@@ -65,6 +74,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
65 | "units": "px" | 74 | "units": "px" |
66 | }, | 75 | }, |
67 | "bindings": { | 76 | "bindings": { |
77 | "units": {"<<->": "@owner.widthUnits"}, | ||
68 | "value": {"<<->": "@owner.widthSize"} | 78 | "value": {"<<->": "@owner.widthSize"} |
69 | } | 79 | } |
70 | 80 | ||
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) { |