From bead8ce9e292f030a4b2fba6ad7fd38fb4fe5199 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 22 Mar 2012 11:16:39 -0700 Subject: IKNINJA-758 - The rotation value of the stage is not updated in the properties panel. Signed-off-by: Nivesh Rajbhandari --- js/mediators/element-mediator.js | 6 +++--- js/panels/properties.reel/properties.js | 15 +++++++++++++-- js/tools/RotateStage3DTool.js | 5 +++-- 3 files changed, 19 insertions(+), 7 deletions(-) (limited to 'js') diff --git a/js/mediators/element-mediator.js b/js/mediators/element-mediator.js index eac0ca54..a2440fb4 100755 --- a/js/mediators/element-mediator.js +++ b/js/mediators/element-mediator.js @@ -673,17 +673,17 @@ exports.ElementMediator = Montage.create(NJComponent, { }, setMatrix: { - value: function(el, mat, isChanging) { + value: function(el, mat, isChanging, source) { var dist = el.elementModel.controller["getPerspectiveDist"](el); el.elementModel.controller["set3DProperties"](el, [{mat:mat, dist:dist}], 0, !isChanging); if(isChanging) { - NJevent("elementChanging", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); + NJevent("elementChanging", {type : "setMatrix", source: source, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); } else { - NJevent("elementChange", {type : "setMatrix", source: null, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); + NJevent("elementChange", {type : "setMatrix", source: source, data: {"els": [el], "prop": "matrix", "value": mat}, redraw: null}); } } }, diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js index 40e9b86a..782dd138 100755 --- a/js/panels/properties.reel/properties.js +++ b/js/panels/properties.reel/properties.js @@ -147,8 +147,12 @@ exports.Properties = Montage.create(Component, { value: function(event) { // console.log("Element Change PI ", event.detail.source); // If the event comes from the pi don't need to update if(event.detail.source && event.detail.source !== "pi") { + var el = this.application.ninja.currentDocument.documentRoot; + if(this.application.ninja.selectedElements.length) { + el = this.application.ninja.selectedElements[0]._element || this.application.ninja.selectedElements[0]; + } + // TODO - This should only update the properties that were changed. - var el = this.application.ninja.selectedElements[0]._element || this.application.ninja.selectedElements[0]; this.positionSize.leftPosition = parseFloat(ElementsMediator.getProperty(el, "left")); this.positionSize.topPosition = parseFloat(ElementsMediator.getProperty(el, "top")); this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(el, "height")); @@ -162,9 +166,9 @@ exports.Properties = Montage.create(Component, { this.threeD.xAngle = ElementsMediator.get3DProperty(el, "xAngle"); this.threeD.yAngle = ElementsMediator.get3DProperty(el, "yAngle"); this.threeD.zAngle = ElementsMediator.get3DProperty(el, "zAngle"); + } } } - } }, handleSelectionChange: { @@ -196,6 +200,13 @@ exports.Properties = Montage.create(Component, { this.positionSize.heightSize = parseFloat(ElementsMediator.getProperty(stage, "height")); this.positionSize.widthSize = parseFloat(ElementsMediator.getProperty(stage, "width")); + if(this.threeD.inGlobalMode) + { + this.threeD.xAngle = ElementsMediator.get3DProperty(stage, "xAngle"); + this.threeD.yAngle = ElementsMediator.get3DProperty(stage, "yAngle"); + this.threeD.zAngle = ElementsMediator.get3DProperty(stage, "zAngle"); + } + if(this.customPi !== stage.elementModel.pi) { // We need to unregister color chips from the previous selection from the Color Model var len = this.customSections.length; diff --git a/js/tools/RotateStage3DTool.js b/js/tools/RotateStage3DTool.js index 2b312e53..f5cc4040 100755 --- a/js/tools/RotateStage3DTool.js +++ b/js/tools/RotateStage3DTool.js @@ -76,7 +76,7 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { this._targets.push({elt:elt, mat:curMat, matInv:curMatInv, ctr:eltCtr}); - viewUtils.setMatrixForElement( elt, curMat, false ); + ElementsMediator.setMatrix(elt, curMat, false, "rotateStage3DTool"); } }, @@ -130,7 +130,8 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { // Reset stage to identity matrix var iMat = Matrix.I(4); - ElementsMediator.setMatrix(this.application.ninja.currentDocument.documentRoot, iMat, false); + ElementsMediator.setMatrix(this.application.ninja.currentDocument.documentRoot, + iMat, false, "rotateStage3DTool"); this.application.ninja.currentDocument.documentRoot.elementModel.props3D.m_transformCtr = null; // let the document and stage manager know about the zoom change -- cgit v1.2.3