aboutsummaryrefslogtreecommitdiff
path: root/js/panels/properties.reel/properties.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/properties.reel/properties.js')
-rwxr-xr-xjs/panels/properties.reel/properties.js74
1 files changed, 60 insertions, 14 deletions
diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js
index e9d9472e..43c92b74 100755
--- a/js/panels/properties.reel/properties.js
+++ b/js/panels/properties.reel/properties.js
@@ -156,6 +156,7 @@ exports.Properties = Montage.create(Component, {
156 156
157 handleElementChange: { 157 handleElementChange: {
158 value: function(event) { 158 value: function(event) {
159 var l, t, h, w, lvu, tvu, hvu, wvu;
159// console.log("Element Change PI ", event.detail.source); // If the event comes from the pi don't need to update 160// console.log("Element Change PI ", event.detail.source); // If the event comes from the pi don't need to update
160 if(event.detail.source && event.detail.source !== "pi") { 161 if(event.detail.source && event.detail.source !== "pi") {
161 var el = this.application.ninja.currentDocument.model.documentRoot; 162 var el = this.application.ninja.currentDocument.model.documentRoot;
@@ -164,10 +165,24 @@ exports.Properties = Montage.create(Component, {
164 } 165 }
165 166
166 // TODO - This should only update the properties that were changed. 167 // TODO - This should only update the properties that were changed.
167 this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(el, "left")); 168 l = ElementsMediator.getProperty(el, "left");
168 this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(el, "top")); 169 t = ElementsMediator.getProperty(el, "top");
169 this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(el, "height")); 170 lvu = document.application.njUtils.getValueAndUnits(l);
170 this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(el, "width")); 171 tvu = document.application.njUtils.getValueAndUnits(t);
172 this.positionSize.leftUnits = lvu[1];
173 this.positionSize.leftPosition = lvu[0];
174 this.positionSize.topUnits = tvu[1];
175 this.positionSize.topPosition = tvu[0];
176
177 h = ElementsMediator.getProperty(el, "height");
178 w = ElementsMediator.getProperty(el, "width");
179 hvu = document.application.njUtils.getValueAndUnits(h);
180 wvu = document.application.njUtils.getValueAndUnits(w);
181
182 this.positionSize.heightUnits = hvu[1] || "px"; // canvas (and shapes) don't have units.
183 this.positionSize.heightSize = hvu[0];
184 this.positionSize.widthUnits = wvu[1] || "px";
185 this.positionSize.widthSize = wvu[0];
171 186
172 if(this.threeD.inGlobalMode) { 187 if(this.threeD.inGlobalMode) {
173 this.threeD.x3D = ElementsMediator.get3DProperty(el, "x3D"); 188 this.threeD.x3D = ElementsMediator.get3DProperty(el, "x3D");
@@ -222,7 +237,8 @@ exports.Properties = Montage.create(Component, {
222 237
223 displayElementProperties: { 238 displayElementProperties: {
224 value: function (el) { 239 value: function (el) {
225 var customPI, currentValue, isRoot = this.application.ninja.selectionController.isDocument; 240 var customPI, currentValue, isRoot = this.application.ninja.selectionController.isDocument,
241 l, t, h, w, lvu, tvu, hvu, wvu;
226 242
227 this.elementName.value = el.elementModel.selection; 243 this.elementName.value = el.elementModel.selection;
228 this.elementId.value = el.getAttribute("id") || ""; 244 this.elementId.value = el.getAttribute("id") || "";
@@ -232,11 +248,24 @@ exports.Properties = Montage.create(Component, {
232 this.threeD.disableTranslation = isRoot; 248 this.threeD.disableTranslation = isRoot;
233 this.threeD.flatten = ElementsMediator.getProperty(el, "-webkit-transform-style") !== "preserve-3d"; 249 this.threeD.flatten = ElementsMediator.getProperty(el, "-webkit-transform-style") !== "preserve-3d";
234 250
235 this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(el, "left")); 251 l = ElementsMediator.getProperty(el, "left");
236 this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(el, "top")); 252 t = ElementsMediator.getProperty(el, "top");
237 this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(el, "height")); 253 lvu = document.application.njUtils.getValueAndUnits(l);
238 this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(el, "width")); 254 tvu = document.application.njUtils.getValueAndUnits(t);
239// this.positionSize.widthSize = ElementsMediator.getProperty(el, "width"); 255 this.positionSize.leftUnits = lvu[1];
256 this.positionSize.leftPosition = lvu[0];
257 this.positionSize.topUnits = tvu[1];
258 this.positionSize.topPosition = tvu[0];
259
260 h = ElementsMediator.getProperty(el, "height");
261 w = ElementsMediator.getProperty(el, "width");
262 hvu = document.application.njUtils.getValueAndUnits(h);
263 wvu = document.application.njUtils.getValueAndUnits(w);
264
265 this.positionSize.heightUnits = hvu[1] || "px"; // canvas (and shapes) don't have units.
266 this.positionSize.heightSize = hvu[0];
267 this.positionSize.widthUnits = wvu[1] || "px";
268 this.positionSize.widthSize = wvu[0];
240 269
241 if(this.threeD.inGlobalMode) 270 if(this.threeD.inGlobalMode)
242 { 271 {
@@ -290,10 +319,23 @@ exports.Properties = Montage.create(Component, {
290 319
291 if(control.type !== "color") { 320 if(control.type !== "color") {
292 currentValue = ElementsMediator.getProperty(el, control.prop, control.valueMutator); 321 currentValue = ElementsMediator.getProperty(el, control.prop, control.valueMutator);
293 if(currentValue === null) { 322 if(control.type === "hottext") {
294 currentValue = control.defaultValue; 323 if(currentValue == null) {
324 currentValue = control.defaultValue;
325 }
326 if(typeof(currentValue) === "string") {
327 currentValue = document.application.njUtils.getValueAndUnits(currentValue);
328 this.customSections[i].content.controls[control.id + "Units"] = currentValue[1] || "px";
329 this.customSections[i].content.controls[control.id] = currentValue[0];
330 } else {
331 this.customSections[i].content.controls[control.id] = currentValue;
332 }
333 } else {
334 if(currentValue === null) {
335 currentValue = control.defaultValue;
336 }
337 this.customSections[i].content.controls[control.id] = currentValue;
295 } 338 }
296 this.customSections[i].content.controls[control.id] = currentValue;
297 } else { 339 } else {
298 if(control.prop === "border") { 340 if(control.prop === "border") {
299 // TODO - For now, always return the top border if multiple border sides 341 // TODO - For now, always return the top border if multiple border sides
@@ -415,7 +457,11 @@ exports.Properties = Montage.create(Component, {
415 value: function(e) { 457 value: function(e) {
416 if(e.wasSetByCode) return; 458 if(e.wasSetByCode) return;
417 459
418 ElementsMediator.setProperty(this.application.ninja.selectedElements, e.prop, [e.value + "px"], "Changing", "pi"); 460 var newValue;
461
462 e.units ? newValue = e.value + e.units : newValue = e.value;
463
464 ElementsMediator.setProperty(this.application.ninja.selectedElements, e.prop, [newValue], "Changing", "pi");
419 } 465 }
420 } 466 }
421 467