diff options
author | Armen Kesablyan | 2012-02-07 16:55:34 -0800 |
---|---|---|
committer | Armen Kesablyan | 2012-02-07 16:55:34 -0800 |
commit | 10f0ad4c15f090b2d0d50d11e4c7aaf291e9eb0e (patch) | |
tree | 12b31910a3c7c7fa2ee0b26d8aaa611710e139a5 /js/stage/stage.reel | |
parent | 7f8730c3add146f1ba107e6fc22d1f5a8348ed8b (diff) | |
parent | 668510892537eaaeb2e11520831d87b44b2489b7 (diff) | |
download | ninja-10f0ad4c15f090b2d0d50d11e4c7aaf291e9eb0e.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into text-tool
Conflicts:
_scss/compass_app_log.txt
css/ninja.css
Diffstat (limited to 'js/stage/stage.reel')
-rw-r--r-- | js/stage/stage.reel/stage.js | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 96bfccdd..6d9a7355 100644 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -176,7 +176,7 @@ exports.Stage = Montage.create(Component, { | |||
176 | } | 176 | } |
177 | else if(this.updatedStage) { | 177 | else if(this.updatedStage) { |
178 | this.layout.draw(); | 178 | this.layout.draw(); |
179 | this.layout.draw3DInfo(); | 179 | this.layout.draw3DInfo(true); |
180 | } | 180 | } |
181 | } | 181 | } |
182 | }, | 182 | }, |
@@ -794,14 +794,9 @@ exports.Stage = Montage.create(Component, { | |||
794 | var userContent = this.application.ninja.currentDocument.documentRoot; | 794 | var userContent = this.application.ninja.currentDocument.documentRoot; |
795 | if (userContent) | 795 | if (userContent) |
796 | { | 796 | { |
797 | var w = userContent.offsetWidth, | 797 | var w = this._canvas.width, |
798 | h = userContent.offsetHeight; | 798 | h = this._canvas.height; |
799 | if(userContent.width) | 799 | var globalPt = [w/2, h/2, 0]; |
800 | w = userContent.width; | ||
801 | if(userContent.height) | ||
802 | h = userContent.height; | ||
803 | var localPt = [ w/2, h/2, 0]; | ||
804 | var globalPt = this.stageDeps.viewUtils.localToGlobal( localPt, userContent ); | ||
805 | 800 | ||
806 | this.stageDeps.viewUtils.setStageZoom( globalPt, value/100 ); | 801 | this.stageDeps.viewUtils.setStageZoom( globalPt, value/100 ); |
807 | 802 | ||
@@ -818,42 +813,66 @@ exports.Stage = Montage.create(Component, { | |||
818 | } | 813 | } |
819 | }, | 814 | }, |
820 | 815 | ||
816 | getPlaneForView: | ||
817 | { | ||
818 | value: function( side ) | ||
819 | { | ||
820 | var plane = [0,0,1,0]; | ||
821 | switch(side) | ||
822 | { | ||
823 | case "top": | ||
824 | plane = [0,1,0,0]; | ||
825 | plane[3] = this.application.ninja.currentDocument.documentRoot.offsetHeight / 2.0; | ||
826 | break; | ||
827 | |||
828 | case "side": | ||
829 | plane = [1,0,0,0]; | ||
830 | plane[3] = this.application.ninja.currentDocument.documentRoot.offsetWidth / 2.0; | ||
831 | break; | ||
832 | |||
833 | case "front": | ||
834 | plane = [0,0,1,0]; | ||
835 | break; | ||
836 | |||
837 | default: | ||
838 | console.log( "unrecognized view in snapManager.getPlaneForView: " + side ); | ||
839 | break; | ||
840 | } | ||
841 | |||
842 | return plane; | ||
843 | } | ||
844 | }, | ||
845 | |||
821 | setStageView: { | 846 | setStageView: { |
822 | value: function(side) { | 847 | value: function(side) { |
823 | var mat, | 848 | var mat, |
824 | workingPlane = null, | 849 | currentDoc = this.application.ninja.currentDocument.documentRoot, |
825 | currentDoc = this.application.ninja.currentDocument.documentRoot; | 850 | isDrawingGrid = this.application.ninja.appModel.show3dGrid; |
826 | // Stage 3d Props. | 851 | // Stage 3d Props. |
827 | currentDoc.elementModel.props3D.ResetTranslationValues(); | 852 | currentDoc.elementModel.props3D.ResetTranslationValues(); |
828 | currentDoc.elementModel.props3D.ResetRotationValues(); | 853 | currentDoc.elementModel.props3D.ResetRotationValues(); |
829 | 854 | ||
830 | 855 | ||
831 | switch(side) { | 856 | switch(side){ |
832 | case "top": | 857 | case "top": |
833 | mat = Matrix.RotationX(Math.PI * 270.0/180.0); | 858 | mat = Matrix.RotationX(Math.PI * 270.0/180.0); |
834 | |||
835 | drawUtils.drawXY = drawUtils.drawYZ = false; | 859 | drawUtils.drawXY = drawUtils.drawYZ = false; |
836 | drawUtils.drawXZ = drawUtils.isDrawingGrid(); | 860 | drawUtils.drawXZ = isDrawingGrid; |
837 | workingPlane = [0,1,0,0]; | ||
838 | break; | 861 | break; |
839 | 862 | ||
840 | case "side": | 863 | case "side": |
841 | mat = Matrix.RotationY(Math.PI * 270/180); | 864 | mat = Matrix.RotationY(Math.PI * 270/180); |
842 | |||
843 | drawUtils.drawXY = drawUtils.drawXZ = false; | 865 | drawUtils.drawXY = drawUtils.drawXZ = false; |
844 | drawUtils.drawYZ = drawUtils.isDrawingGrid(); | 866 | drawUtils.drawYZ = isDrawingGrid; |
845 | workingPlane = [1,0,0,0]; | ||
846 | break; | 867 | break; |
847 | 868 | ||
848 | case "front": | 869 | case "front": |
849 | mat = Matrix.I(4); | 870 | mat = Matrix.I(4); |
850 | |||
851 | drawUtils.drawYZ = drawUtils.drawXZ = false; | 871 | drawUtils.drawYZ = drawUtils.drawXZ = false; |
852 | drawUtils.drawXY = drawUtils.isDrawingGrid(); | 872 | drawUtils.drawXY = isDrawingGrid; |
853 | workingPlane = [0,0,1,0]; | ||
854 | break; | 873 | break; |
855 | } | 874 | } |
856 | 875 | workingPlane = this.getPlaneForView( side ); | |
857 | 876 | ||
858 | this.stageDeps.viewUtils.setMatrixForElement(currentDoc, mat, false); | 877 | this.stageDeps.viewUtils.setMatrixForElement(currentDoc, mat, false); |
859 | 878 | ||