From 12371bb25ca51286c19a426611d9b7db369bec87 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 31 Jan 2012 11:09:21 -0800 Subject: Support stage in PI's 3d section. Signed-off-by: Nivesh Rajbhandari --- .../sections/three-d-view.reel/three-d-view.js | 63 ++++++++++++++-------- 1 file changed, 41 insertions(+), 22 deletions(-) (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 38dbb110..dda9f993 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 @@ -40,19 +40,16 @@ exports.ThreeD = Montage.create(Component, { else { this.inGlobalMode = true; - if(this.application.ninja.selectedElements.length) + var item = this.item; + if(item) { - var item = this.application.ninja.selectedElements[0]._element; - if(item) - { - this.x3D = item.elementModel.props3D.x3D; - this.y3D = item.elementModel.props3D.y3D; - this.z3D = item.elementModel.props3D.z3D; - - this.xAngle = item.elementModel.props3D.xAngle; - this.yAngle = item.elementModel.props3D.yAngle; - this.zAngle = item.elementModel.props3D.zAngle; - } + this.x3D = item.elementModel.props3D.x3D; + this.y3D = item.elementModel.props3D.y3D; + this.z3D = item.elementModel.props3D.z3D; + + this.xAngle = item.elementModel.props3D.xAngle; + this.yAngle = item.elementModel.props3D.yAngle; + this.zAngle = item.elementModel.props3D.zAngle; } } } @@ -98,6 +95,10 @@ exports.ThreeD = Montage.create(Component, { } }, + item: { + value: null + }, + handleChange: { value: function(event) { if(event.wasSetByCode) { @@ -106,7 +107,7 @@ exports.ThreeD = Montage.create(Component, { this.apply3DProperties(event.currentTarget.identifier, event.currentTarget, - this.application.ninja.selectedElements[0]._element, + this.item, this.inGlobalMode, false); } @@ -120,7 +121,7 @@ exports.ThreeD = Montage.create(Component, { this.apply3DProperties(event.currentTarget.identifier, event.currentTarget, - this.application.ninja.selectedElements[0]._element, + this.item, this.inGlobalMode, true); } @@ -128,9 +129,8 @@ exports.ThreeD = Montage.create(Component, { apply3DProperties : { value : function(prop, value, item, inGlobalMode, isChanging){ - // TODO - May want to use mediator instead - var curMat = item.elementModel.props3D.matrix3d; - var delta = value.value - item.elementModel.props3D[prop]; + var curMat = this.application.ninja.elementMediator.getMatrix(item); + var delta = value.value - this.application.ninja.elementMediator.get3DProperty(item, prop); var xFormMat = Matrix.I(4); switch (prop) @@ -183,12 +183,31 @@ exports.ThreeD = Montage.create(Component, { templateDidLoad : { value: function() { - Object.defineBinding(this, "axisMode", { - boundObject: this.axisModeGroupControl, - boundObjectPropertyPath: "selectedIndex", - oneway: false - }); + Object.defineBinding(this, "axisMode", { + boundObject: this.axisModeGroupControl, + boundObjectPropertyPath: "selectedIndex", + oneway: false + }); + + Object.defineBinding(this, "item", { + boundObject: this, + boundObjectPropertyPath: "application.ninja.selectedElements", + boundValueMutator: this._getSelectedItem + }); + } + }, + _getSelectedItem: { + value: function(els) + { + if(els.length) + { + return els[0]._element || els[0]; + } + else + { + return this.boundObject.application.ninja.currentDocument.documentRoot; + } } }, -- cgit v1.2.3 From c0f43749523f4720ca4c8942fa9ac17753d93a67 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 31 Jan 2012 15:01:04 -0800 Subject: Fixing 3d section of the PI. Signed-off-by: Nivesh Rajbhandari --- .../sections/three-d-view.reel/three-d-view.html | 12 +++++----- .../sections/three-d-view.reel/three-d-view.js | 27 ++++++++++++++++++++-- 2 files changed, 31 insertions(+), 8 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 1e24cb55..11a5b3f2 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": false + "oneway": true } }, "listeners": [ @@ -68,7 +68,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "y3D", - "oneway": false + "oneway": true } }, "listeners": [ @@ -97,7 +97,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "z3D", - "oneway": false + "oneway": true } }, "listeners": [ @@ -128,7 +128,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "xAngle", - "oneway": false + "oneway": true } }, "listeners": [ @@ -159,7 +159,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "yAngle", - "oneway": false + "oneway": true } }, "listeners": [ @@ -190,7 +190,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot "value": { "boundObject": {"@": "owner"}, "boundObjectPropertyPath": "zAngle", - "oneway": false + "oneway": true } }, "listeners": [ 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 dda9f993..96053490 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 @@ -99,6 +99,14 @@ exports.ThreeD = Montage.create(Component, { value: null }, + _curMat: { + value: null + }, + + _curProp: { + value: null + }, + handleChange: { value: function(event) { if(event.wasSetByCode) { @@ -110,6 +118,9 @@ exports.ThreeD = Montage.create(Component, { this.item, this.inGlobalMode, false); + + this._curMat = null; + this._curProp = null; } }, @@ -129,8 +140,20 @@ exports.ThreeD = Montage.create(Component, { apply3DProperties : { value : function(prop, value, item, inGlobalMode, isChanging){ - var curMat = this.application.ninja.elementMediator.getMatrix(item); - var delta = value.value - this.application.ninja.elementMediator.get3DProperty(item, prop); + if(!this._curMat) + { + this._curMat = this.application.ninja.elementMediator.getMatrix(item); + } + var curMat = this._curMat; + var delta = value.value; + if(inGlobalMode) + { + if(!this._curProp) + { + this._curProp = this.application.ninja.elementMediator.get3DProperty(item, prop); + } + delta -= this._curProp; + } var xFormMat = Matrix.I(4); switch (prop) -- cgit v1.2.3 From 89d64cf06e170c3c50b02eeadd9dcf10d6efe1a3 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 2 Feb 2012 13:22:30 -0800 Subject: Updating Shapes PI to support corner radii. Also fixed PI bug where we were always updating custom section 0. Signed-off-by: Nivesh Rajbhandari --- js/panels/properties/content.reel/content.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 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 fe6faef8..3cedee6d 100644 --- a/js/panels/properties/content.reel/content.js +++ b/js/panels/properties/content.reel/content.js @@ -182,8 +182,11 @@ exports.Content = Montage.create(Component, { if(control.prop !== "border-color" && control.prop !== "background-color") { var currentValue = ElementsMediator.getProperty(el, control.prop, control.valueMutator); - currentValue ? currentValue = currentValue : currentValue = control.defaultValue; - this.customSections[0].content.controls[control.id] = currentValue; + if(currentValue === null) + { + currentValue = control.defaultValue; + } + this.customSections[i].content.controls[control.id] = currentValue; } } } -- cgit v1.2.3