From f94b0c5ada403379b3ff8a900c2a2aabcecce49e Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 6 Feb 2012 14:03:40 -0800 Subject: Add enabled property for ComboBox to support enabling/disabling materials dropdowns in the PI. Signed-off-by: Nivesh Rajbhandari --- js/panels/properties/sections/custom.reel/custom.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'js/panels/properties') diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js index 2b5b522a..e92a39fd 100644 --- a/js/panels/properties/sections/custom.reel/custom.js +++ b/js/panels/properties/sections/custom.reel/custom.js @@ -193,6 +193,18 @@ exports.CustomSection = Montage.create(Component, { obj.items = aField.items; } } + if (aField.enabled) { + if(aField.enabled.boundObject) { + // TODO - For now, always bind to this.controls[someProperty] + Object.defineBinding(obj, "enabled", { + boundObject: this.controls, + boundObjectPropertyPath: aField.enabled.boundProperty, + oneway: false + }); + } else { + obj.enabled = aField.enabled; + } + } obj.addEventListener("change", this, false); // -- cgit v1.2.3 From 8ad767b61460984a4031ba630f76ac8247a61857 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 7 Feb 2012 11:42:10 -0800 Subject: Fixed PI to support WebGL materials. Signed-off-by: Nivesh Rajbhandari --- js/panels/properties/sections/custom.reel/custom.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/panels/properties') diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js index e92a39fd..992db8e6 100644 --- a/js/panels/properties/sections/custom.reel/custom.js +++ b/js/panels/properties/sections/custom.reel/custom.js @@ -186,6 +186,8 @@ exports.CustomSection = Montage.create(Component, { if (aField.value) obj.value = aField.value; if (aField.labelField) obj.labelField = aField.labelField; if (aField.labelFunction) obj.labelFunction = aField.labelFunction; + if (aField.dataField) obj.dataField = aField.dataField; + if (aField.dataFunction) obj.dataFunction = aField.dataFunction; if (aField.items) { if(aField.items.boundObject) { obj.items = eval(aField.items.boundObject)[aField.items.boundProperty]; -- cgit v1.2.3 From cd997c18bdb346ff44919880239e705df80079ea Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 8 Feb 2012 14:30:56 -0800 Subject: Fix for the PI Lock button. Fixing the following JIRA bugs: 111 Signed-off-by: Valerio Virgillito --- .../position-and-size.reel/position-and-size.js | 94 ++++++++++++++++++---- 1 file changed, 78 insertions(+), 16 deletions(-) (limited to 'js/panels/properties') diff --git a/js/panels/properties/sections/position-and-size.reel/position-and-size.js b/js/panels/properties/sections/position-and-size.reel/position-and-size.js index 43f08fcf..e539257d 100644 --- a/js/panels/properties/sections/position-and-size.reel/position-and-size.js +++ b/js/panels/properties/sections/position-and-size.reel/position-and-size.js @@ -28,6 +28,14 @@ exports.PosSize = Montage.create(Component, { value: null }, + aspectRatioWidth: { + value: null + }, + + aspectRatioHeight: { + value: null + }, + _disablePosition: { value: true }, @@ -62,9 +70,8 @@ exports.PosSize = Montage.create(Component, { this.widthControl.addEventListener("change", this, false); this.widthControl.addEventListener("changing", this, false); - - //this._controlList[0].control.addEventListener("action", this._handleStageEvent.bind(this), false); - //PropertiesPanelModule.PropertiesPanelBase.PIControlList["stageWidthHeightLock"] = this._controlList[0].control; + this.bindButton.identifier = "ratio"; + this.bindButton.addEventListener("action", this, false); } }, @@ -87,6 +94,25 @@ exports.PosSize = Montage.create(Component, { } }, + /** + * Calculate the current aspect ration when the bind button is pressed. + * If one of the values is 0, then use 1:1 as the ratio; + */ + handleRatioAction: { + value: function() { + if(this.bindButton.value) { + this.aspectRatioWidth = this.heightControl.value / this.widthControl.value; + if(isNaN(this.aspectRatioWidth) || !isFinite(this.aspectRatioWidth) || this.aspectRatioWidth === 0) this.aspectRatioWidth = 1; + + this.aspectRatioHeight = this.widthControl.value / this.heightControl.value; + if(isNaN(this.aspectRatioHeight) || !isFinite(this.aspectRatioHeight) || this.aspectRatioHeight === 0) this.aspectRatioHeight = 1; + } else { + this.aspectRatioWidth = 1; + this.aspectRatioHeight = 1; + } + } + }, + handleLeftChange: { value: function(event) { var prevPosition; @@ -121,6 +147,16 @@ exports.PosSize = Montage.create(Component, { if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; + + if(this.bindButton.value) { + var newWidth = Math.round(this.aspectRatioHeight * this.heightControl.value); + + if(!isFinite(newWidth)) newWidth = this.heightControl.value; + + this.widthControl.value = newWidth; + this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Change", "pi"); + } + this.application.ninja.elementMediator.setProperty(items, "height", [this.heightControl.value + "px"] , "Change", "pi", prevPosition); this.savedPosition = null; } @@ -135,9 +171,25 @@ exports.PosSize = Montage.create(Component, { if(this.savedPosition) prevPosition = [this.savedPosition + "px"]; this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; - this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + "px"] , "Change", "pi", prevPosition); - this.savedPosition = null; + + if(this.bindButton.value) { + + var newHeight = Math.round(this.aspectRatioWidth * this.widthControl.value); + + if(!isFinite(newHeight)) newHeight = this.widthControl.value; + + this.heightControl.value = newHeight; + this.application.ninja.elementMediator.setProperty(items, "height", [newHeight + "px"] , "Change", "pi"); + + } else { + + this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + "px"] , "Change", "pi", prevPosition); + this.savedPosition = null; + } + + } + } }, @@ -166,24 +218,22 @@ exports.PosSize = Montage.create(Component, { var items; if(!event.wasSetByCode) { + if(!this.savedPosition) this.savedPosition = this.heightSize; + + this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; + if(this.bindButton.value) { - if(!this.savedPosition) this.savedPosition = this.heightSize; - var delta = this.heightControl.value - this.savedPosition; - var hwRatio = Math.round(Math.round(this.widthControl.value / this.savedPosition * 10) / 10); - var newWidth = this.widthControl.value + hwRatio * delta; + var newWidth = Math.round(this.aspectRatioHeight * this.heightControl.value); + + if(!isFinite(newWidth)) newWidth = this.heightControl.value; - this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; this.widthControl.value = newWidth; - this.application.ninja.elementMediator.setProperty(items, "height", [this.heightControl.value + "px"] , "Changing", "pi"); this.application.ninja.elementMediator.setProperty(items, "width", [newWidth + "px"] , "Changing", "pi"); - } else { + } - if(!this.savedPosition) this.savedPosition = this.heightSize; + this.application.ninja.elementMediator.setProperty(items, "height", [this.heightControl.value + "px"] , "Changing", "pi"); - this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; - this.application.ninja.elementMediator.setProperty(items, "height", [this.heightControl.value + "px"] , "Changing", "pi"); - } } } }, @@ -192,8 +242,20 @@ exports.PosSize = Montage.create(Component, { value: function(event) { var items; if(!event.wasSetByCode) { + if(!this.savedPosition) this.savedPosition = this.widthSize; + this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; + + if(this.bindButton.value) { + var newHeight = Math.round(this.aspectRatioWidth * this.widthControl.value); + + if(!isFinite(newHeight)) newHeight = this.widthControl.value; + + this.heightControl.value = newHeight; + this.application.ninja.elementMediator.setProperty(items, "height", [newHeight + "px"] , "Changing", "pi"); + } + this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + "px"] , "Changing", "pi"); } } -- cgit v1.2.3 From 88e80d512bdd125e6d604541c291f699bf5df564 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 8 Feb 2012 17:49:02 -0800 Subject: Correcting the PI lock for height which had a bug in the original pull request. Signed-off-by: Valerio Virgillito --- .../sections/position-and-size.reel/position-and-size.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'js/panels/properties') diff --git a/js/panels/properties/sections/position-and-size.reel/position-and-size.js b/js/panels/properties/sections/position-and-size.reel/position-and-size.js index e539257d..49117090 100644 --- a/js/panels/properties/sections/position-and-size.reel/position-and-size.js +++ b/js/panels/properties/sections/position-and-size.reel/position-and-size.js @@ -149,6 +149,7 @@ exports.PosSize = Montage.create(Component, { this.application.ninja.selectedElements.length ? items = this.application.ninja.selectedElements : items = [this.application.ninja.currentDocument.documentRoot]; if(this.bindButton.value) { + var newWidth = Math.round(this.aspectRatioHeight * this.heightControl.value); if(!isFinite(newWidth)) newWidth = this.heightControl.value; @@ -181,12 +182,10 @@ exports.PosSize = Montage.create(Component, { this.heightControl.value = newHeight; this.application.ninja.elementMediator.setProperty(items, "height", [newHeight + "px"] , "Change", "pi"); - } else { - - this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + "px"] , "Change", "pi", prevPosition); - this.savedPosition = null; } + this.application.ninja.elementMediator.setProperty(items, "width", [this.widthControl.value + "px"] , "Change", "pi", prevPosition); + this.savedPosition = null; } -- cgit v1.2.3