aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
authorEric Guzman2012-05-29 15:29:11 -0700
committerEric Guzman2012-05-29 15:29:11 -0700
commit25ac55c285bb4850118c644dc57adaeda5b9a859 (patch)
treeb645941d7916716cbaf4860355df4101fc0f4c3c /js/helper-classes
parent1fda3cea5f8dced1e14533969722e30b8ea1e6fa (diff)
parent58e454c828abf0b64fa62120359bcd78a0d34ac4 (diff)
downloadninja-25ac55c285bb4850118c644dc57adaeda5b9a859.tar.gz
Merge branch 'dom-architecture' of github.com:Motorola-Mobility/ninja-internal into CSSPanelUpdates
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js31
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js13
-rwxr-xr-xjs/helper-classes/3D/view-utils.js55
3 files changed, 44 insertions, 55 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index bf48a723..871b832d 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -119,20 +119,23 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
119 119
120 initializeFromDocument:{ 120 initializeFromDocument:{
121 value:function(){ 121 value:function(){
122 var documentRootChildren = null, i, stage = this.application.ninja.stage; 122 var i,
123 documentRootChildren = this.application.ninja.currentDocument.model.views.design.getLiveNodeList(true),
124 stage = this.application.ninja.stage,
125 len = documentRootChildren.length;
123 //initialize with current document 126 //initialize with current document
124 this._eltArray = []; 127 this._eltArray = [];
125 this._planesArray = []; 128 this._planesArray = [];
126 this.setDrawingSurfaceElement(stage.canvas); 129 this.setDrawingSurfaceElement(stage.canvas);
127 this.setSourceSpaceElement( this.application.ninja.currentDocument.documentRoot); 130 this.setSourceSpaceElement( this.application.ninja.currentDocument.model.documentRoot);
128 this.setWorkingPlane( [0,0,1,0] ); 131 this.setWorkingPlane( [0,0,1,0] );
129 132
130 //Loop through all the top-level children of the current document and call drawUtils.addElement on them 133 //Loop through all the top-level children of the current document and call drawUtils.addElement on them
131 if(this.application.ninja.currentDocument._liveNodeList.length > 0){ 134 if(len > 0) {
132 documentRootChildren = this.application.ninja.currentDocument._liveNodeList; 135 var initL = 0,
133 var len = documentRootChildren.length, 136 initT = 0,
134 minLeft = stage.userPaddingLeft, 137 minLeft = 0,
135 minTop = stage.userPaddingTop, 138 minTop = 0,
136 docLeft = stage.documentOffsetLeft, 139 docLeft = stage.documentOffsetLeft,
137 docTop = stage.documentOffsetTop, 140 docTop = stage.documentOffsetTop,
138 l, 141 l,
@@ -151,10 +154,10 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
151 minTop = t; 154 minTop = t;
152 } 155 }
153 } 156 }
154 if(minLeft !== stage.userPaddingLeft) { 157 if(minLeft !== initL) {
155 stage.userPaddingLeft = minLeft; 158 stage.userPaddingLeft = minLeft;
156 } 159 }
157 if(minTop !== stage.userPaddingTop) { 160 if(minTop !== initT) {
158 stage.userPaddingTop = minTop; 161 stage.userPaddingTop = minTop;
159 } 162 }
160 } 163 }
@@ -697,7 +700,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
697 this._lineColor = saveColor; 700 this._lineColor = saveColor;
698 this._drawingContext.lineWidth = saveLineWidth; 701 this._drawingContext.lineWidth = saveLineWidth;
699 702
700 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { 703 if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") {
701 // draw an outline around the body 704 // draw an outline around the body
702 var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); 705 var stagePt = MathUtils.getPointOnPlane([0,0,1,0]);
703 var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); 706 var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt);
@@ -815,7 +818,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
815 // draw the lines 818 // draw the lines
816 var line, 819 var line,
817 nLines = this._gridLineArray.length; 820 nLines = this._gridLineArray.length;
818 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { 821 if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") {
819 nLines = this._gridLineArray.length-4; 822 nLines = this._gridLineArray.length-4;
820 } 823 }
821 824
@@ -824,7 +827,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
824 this.drawIntersectedLine(line, this._drawingContext); 827 this.drawIntersectedLine(line, this._drawingContext);
825 } 828 }
826 829
827 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { 830 if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") {
828 this._lineColor = "red"; 831 this._lineColor = "red";
829 i = nLines; 832 i = nLines;
830 nLines += 4; 833 nLines += 4;
@@ -923,7 +926,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
923 // if all of the planes are aligned, check if they are aligned with the view direction 926 // if all of the planes are aligned, check if they are aligned with the view direction
924 if (flat) 927 if (flat)
925 { 928 {
926 var stage = this.application.ninja.currentDocument.documentRoot; 929 var stage = this.application.ninja.currentDocument.model.documentRoot;
927 var stageMat = this.viewUtils.getMatrixFromElement(stage); 930 var stageMat = this.viewUtils.getMatrixFromElement(stage);
928 var viewDir = [ stageMat[8], stageMat[9], stageMat[10] ]; 931 var viewDir = [ stageMat[8], stageMat[9], stageMat[10] ];
929 viewDir = vecUtils.vecNormalize( 3, viewDir ); 932 viewDir = vecUtils.vecNormalize( 3, viewDir );
@@ -1213,7 +1216,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
1213 value: function() { 1216 value: function() {
1214 // set the element to be the viewport object - temporarily 1217 // set the element to be the viewport object - temporarily
1215 var tmpCanvas = this.application.ninja.stage.canvas; 1218 var tmpCanvas = this.application.ninja.stage.canvas;
1216 var tmpStage = this.application.ninja.currentDocument.documentRoot; 1219 var tmpStage = this.application.ninja.currentDocument.model.documentRoot;
1217 this.viewUtils.pushViewportObj( tmpCanvas ); 1220 this.viewUtils.pushViewportObj( tmpCanvas );
1218 1221
1219 // save the source space object and set to the target object 1222 // save the source space object and set to the target object
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index 0f456e1e..069c6022 100755
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -83,14 +83,14 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
83 popWorkingPlane : { value: function () { workingPlane = this._workingPlaneStack.pop(); return workingPlane; }}, 83 popWorkingPlane : { value: function () { workingPlane = this._workingPlaneStack.pop(); return workingPlane; }},
84 84
85 getStageWidth : { value: function () { 85 getStageWidth : { value: function () {
86 return parseInt(this.application.ninja.currentDocument.documentRoot.offsetWidth); 86 return parseInt(this.application.ninja.currentDocument.model.documentRoot.offsetWidth);
87 }}, 87 }},
88 88
89 getStageHeight : { value: function () { 89 getStageHeight : { value: function () {
90 return parseInt(this.application.ninja.currentDocument.documentRoot.offsetHeight); 90 return parseInt(this.application.ninja.currentDocument.model.documentRoot.offsetHeight);
91 }}, 91 }},
92 92
93 getStage : { value: function() { return this.application.ninja.currentDocument.documentRoot; }}, 93 getStage : { value: function() { return this.application.ninja.currentDocument.model.documentRoot; }},
94 94
95 getGridVertexHitRad : { value: function() { return this._gridVertexHitRad; }}, 95 getGridVertexHitRad : { value: function() { return this._gridVertexHitRad; }},
96 getGridEdgeHitRad : { value: function() { return this._gridEdgeHitRad; }}, 96 getGridEdgeHitRad : { value: function() { return this._gridEdgeHitRad; }},
@@ -470,13 +470,6 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
470 } 470 }
471 }, 471 },
472 472
473 reload2DCache: {
474 value: function() {
475 this.clear2DCache();
476 this.load2DCache(workingPlane);
477 }
478 },
479
480 clear2DCache : { 473 clear2DCache : {
481 value : function() { 474 value : function() {
482 // clear the 2D cache flags in the objects 475 // clear the 2D cache flags in the objects
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index 0080bf90..a3d09404 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -24,9 +24,6 @@ exports.ViewUtils = Montage.create(Component, {
24 // keep a stack of viewport objects 24 // keep a stack of viewport objects
25 _viewportObjStack: { value: []}, 25 _viewportObjStack: { value: []},
26 26
27 _userContentLeft: { value: null},
28 _userContentTop: { value: null},
29
30 /////////////////////////////////////////////////////////////////////// 27 ///////////////////////////////////////////////////////////////////////
31 // Property accessors 28 // Property accessors
32 /////////////////////////////////////////////////////////////////////// 29 ///////////////////////////////////////////////////////////////////////
@@ -39,9 +36,6 @@ exports.ViewUtils = Montage.create(Component, {
39 }, 36 },
40 getViewportObj: { value: function() { return this.m_viewportObj; } }, 37 getViewportObj: { value: function() { return this.m_viewportObj; } },
41 38
42 setUserContentLeft: { value: function(value) { this._userContentLeft = value; }},
43 setUserContentTop: { value: function(value) { this._userContentTop = value; }},
44
45 getPerspectiveDistance: { value: function () { return this._perspectiveDist; } }, 39 getPerspectiveDistance: { value: function () { return this._perspectiveDist; } },
46 40
47 /////////////////////////////////////////////////////////////////////// 41 ///////////////////////////////////////////////////////////////////////
@@ -126,7 +120,7 @@ exports.ViewUtils = Montage.create(Component, {
126 var yVec = [0,1,0]; 120 var yVec = [0,1,0];
127 var zVec = [0,0,1]; 121 var zVec = [0,0,1];
128 122
129 var stage = this.application.ninja.currentDocument.documentRoot; 123 var stage = this.application.ninja.currentDocument.model.documentRoot;
130 var stageMat = this.getMatrixFromElement(stage); 124 var stageMat = this.getMatrixFromElement(stage);
131 125
132 var mat = glmat4.multiply( stageMat, objMat, [] ); 126 var mat = glmat4.multiply( stageMat, objMat, [] );
@@ -286,7 +280,7 @@ exports.ViewUtils = Montage.create(Component, {
286 // into stage world space. 280 // into stage world space.
287 postViewToStageWorld: { 281 postViewToStageWorld: {
288 value: function( localPt, elt ) { 282 value: function( localPt, elt ) {
289 if ((elt == null) || (elt === this.application.ninja.currentDocument.documentRoot)) return localPt; 283 if ((elt == null) || (elt === this.application.ninja.currentDocument.model.documentRoot)) return localPt;
290 284
291 // get the 3D transformation and 2D offset from the element 285 // get the 3D transformation and 2D offset from the element
292 var pt = localPt.slice(0); 286 var pt = localPt.slice(0);
@@ -313,7 +307,7 @@ exports.ViewUtils = Montage.create(Component, {
313 this.popViewportObj(); 307 this.popViewportObj();
314 308
315 // check if we are done 309 // check if we are done
316 if (parent === this.application.ninja.currentDocument.documentRoot) break;