From 79ef4e4f51f8981feac3f3bddb6a06aa37407542 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 8 Feb 2012 09:53:32 -0800 Subject: Fixed radio button to update 3d values when switching from local to global and vice-versa. Signed-off-by: Nivesh Rajbhandari --- .../properties/sections/three-d-view.reel/three-d-view.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'js/panels/properties') diff --git a/js/panels/properties/sections/three-d-view.reel/three-d-view.html b/js/panels/properties/sections/three-d-view.reel/three-d-view.html index 11a5b3f2..1e24cb55 100644 --- a/js/panels/properties/sections/three-d-view.reel/three-d-view.html +++ b/js/panels/properties/sections/three-d-view.reel/three-d-view.html @@ -39,7 +39,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "x3D", - "oneway": true + "oneway": false } }, "listeners": [ @@ -68,7 +68,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "y3D", - "oneway": true + "oneway": false } }, "listeners": [ @@ -97,7 +97,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "z3D", - "oneway": true + "oneway": false } }, "listeners": [ @@ -128,7 +128,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "xAngle", - "oneway": true + "oneway": false } }, "listeners": [ @@ -159,7 +159,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "yAngle", - "oneway": true + "oneway": false } }, "listeners": [ @@ -190,7 +190,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "zAngle", - "oneway": true + "oneway": false } }, "listeners": [ -- 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 From e78f4312c194d9e8188075cf1fe87e4be22b24e4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 9 Feb 2012 11:56:40 -0800 Subject: adding oneway to the 3d bindings to fix a bug where the stage was getting selected. Signed-off-by: Valerio Virgillito --- js/panels/properties/sections/three-d-view.reel/three-d-view.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/panels/properties') diff --git a/js/panels/properties/sections/three-d-view.reel/three-d-view.js b/js/panels/properties/sections/three-d-view.reel/three-d-view.js index 96053490..0c4a9171 100644 --- a/js/panels/properties/sections/three-d-view.reel/three-d-view.js +++ b/js/panels/properties/sections/three-d-view.reel/three-d-view.js @@ -215,7 +215,8 @@ exports.ThreeD = Montage.create(Component, { Object.defineBinding(this, "item", { boundObject: this, boundObjectPropertyPath: "application.ninja.selectedElements", - boundValueMutator: this._getSelectedItem + boundValueMutator: this._getSelectedItem, + oneway: true }); } }, -- cgit v1.2.3 From a30d76ff641ce89686cf5fbd9f04ac9ab4e9c830 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 10 Feb 2012 17:21:28 -0800 Subject: initial color chip for the stage Signed-off-by: Valerio Virgillito --- js/panels/properties/content.reel/content.js | 37 +++++++++++++++++ .../properties/sections/custom.reel/custom.js | 46 +++++++++++++++++++--- 2 files changed, 78 insertions(+), 5 deletions(-) (limited to 'js/panels/properties') diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index 0088447a..b15f2d71 100644 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -150,6 +150,43 @@ exports.Content = Montage.create(Component, { this.customPi = stage.elementModel.pi; this.displayCustomProperties(stage, stage.elementModel.pi); } + + // For now hardcode the background since it is the only custom property + // No need to loop through all the properties. + var backgroundChip = this.customSections[0].content.controls["background"]; + backgroundChip.initialColor = ElementsMediator.getProperty(stage, "background"); + + // Get stage color + //var backgroundColor = + //console.log(backgroundColor); + + /* + var customPI = PiData[this.customPi]; + // Get all the custom section for the custom PI + for(var i = 0, customSec; customSec = customPI[i]; i++) { + + // Now set the Fields for the custom PI + for(var j = 0, fields; fields = customSec.Section[j]; j++) { + for(var k = 0, control; control = fields[k]; k++) { + + var colorChipEl = this.customSections[i].content.controls[control.id]; + this.foo = colorChipEl; + colorChipEl.addEventListener("firstDraw", this, false); + + } + } + } + */ + } + }, + + foo: { + value: null + }, + + handleFirstDraw: { + value: function() { + this.foo.chipBtn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 255, g: 0, b: 0}, css: 'rgb(255,0,0)'}); } }, diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js index 992db8e6..5315defc 100644 --- a/js/panels/properties/sections/custom.reel/custom.js +++ b/js/panels/properties/sections/custom.reel/custom.js @@ -6,6 +6,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage; var Component = require("montage/ui/component").Component; +var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; //Custom Rows var SingleRow = require("js/panels/properties/sections/custom-rows/single-row.reel").SingleRow; @@ -18,7 +19,7 @@ var Dropdown = require("js/components/combobox.reel").Combobox; var TextField = require("js/components/textfield.reel").TextField; var FileInput = require("js/components/ui/file-input.reel").FileInput; var Checkbox = require("js/components/checkbox.reel").Checkbox; - +var ColorChip = require("js/components/ui/color-chip.reel").ColorChip; exports.CustomSection = Montage.create(Component, { @@ -88,10 +89,8 @@ exports.CustomSection = Montage.create(Component, { value:{} }, - handleChanging: - { - value:function(event) - { + handleChanging: { + value:function(event) { var obj = event.currentTarget; this._dispatchPropEvent({"type": "changing", "id": obj.id, "prop": obj.prop, "value": obj.value, "control": obj}); } @@ -106,6 +105,26 @@ exports.CustomSection = Montage.create(Component, { } }, + handleColorChange: { + value: function(event) { + // Change the stage color for now + console.log(this); + console.log(event); + console.log(event._event.color.css); + ElementsMediator.setProperty([this.application.ninja.currentDocument.documentRoot], "background", [event._event.color.css], "Change", "pi", 'foo'); + /* + var propEvent = document.createEvent("CustomEvent"); + propEvent.initEvent("propertyChange", true, true); + propEvent.type = "propertyChange"; + + propEvent.prop = "background";//event.prop; + propEvent.value = event._event.color.css; + + this.dispatchEvent(propEvent); + */ + } + }, + _dispatchPropEvent: { value: function(event) { // console.log(event); @@ -140,6 +159,7 @@ exports.CustomSection = Montage.create(Component, { case "textbox" : return this.createTextField(fields); case "file" : return this.createFileInput(fields); case "checkbox" : return this.createCheckbox(fields); + case "chip" : return this.createColorChip(fields); } } }, @@ -303,6 +323,22 @@ exports.CustomSection = Montage.create(Component, { boundObjectPropertyPath: "checked" }); + return obj; + } + }, + + createColorChip: { + value: function(aField) { + var obj = ColorChip.create(); + obj.chip = true; + obj.iconType = "fillIcon"; + obj.mode = "chip"; + obj.offset = 0; + + obj.changeDelegate = this.handleColorChange; + + this.controls[aField.id] = obj; + return obj; } } -- cgit v1.2.3 From 0d7d6d4d98437a93f31ededa14ca6eb5382c9e58 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 13 Feb 2012 14:05:10 -0800 Subject: Cleaning up the stage background color chip. Signed-off-by: Valerio Virgillito --- js/panels/properties/content.reel/content.js | 8 -------- js/panels/properties/sections/custom.reel/custom.js | 13 +++++++++---- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'js/panels/properties') diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js index b15f2d71..1ec6d769 100644 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -156,10 +156,6 @@ exports.Content = Montage.create(Component, { var backgroundChip = this.customSections[0].content.controls["background"]; backgroundChip.initialColor = ElementsMediator.getProperty(stage, "background"); - // Get stage color - //var backgroundColor = - //console.log(backgroundColor); - /* var customPI = PiData[this.customPi]; // Get all the custom section for the custom PI @@ -180,10 +176,6 @@ exports.Content = Montage.create(Component, { } }, - foo: { - value: null - }, - handleFirstDraw: { value: function() { this.foo.chipBtn.color('rgb', {wasSetByCode: true, type: 'change', color: {r: 255, g: 0, b: 0}, css: 'rgb(255,0,0)'}); diff --git a/js/panels/properties/sections/custom.reel/custom.js b/js/panels/properties/sections/custom.reel/custom.js index 5315defc..a2b9b9fa 100644 --- a/js/panels/properties/sections/custom.reel/custom.js +++ b/js/panels/properties/sections/custom.reel/custom.js @@ -105,13 +105,14 @@ exports.CustomSection = Montage.create(Component, { } }, + /** + * Color change handler. Hard coding the stage for now since only the stage PI uses this color chip + */ handleColorChange: { value: function(event) { // Change the stage color for now - console.log(this); - console.log(event); - console.log(event._event.color.css); - ElementsMediator.setProperty([this.application.ninja.currentDocument.documentRoot], "background", [event._event.color.css], "Change", "pi", 'foo'); + //console.log(this, event); + ElementsMediator.setProperty([this.application.ninja.currentDocument.documentRoot], this.id, [event._event.color.css], "Change", "pi", ''); /* var propEvent = document.createEvent("CustomEvent"); propEvent.initEvent("propertyChange", true, true); @@ -330,11 +331,15 @@ exports.CustomSection = Montage.create(Component, { createColorChip: { value: function(aField) { var obj = ColorChip.create(); + obj.chip = true; obj.iconType = "fillIcon"; obj.mode = "chip"; obj.offset = 0; + if (aField.id) obj.id = aField.id; + if (aField.prop) obj.prop = aField.prop; + obj.changeDelegate = this.handleColorChange; this.controls[aField.id] = obj; -- cgit v1.2.3