aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-05-24 00:07:23 -0700
committerJose Antonio Marquez2012-05-24 00:07:23 -0700
commit5914c5b2209c4b8daac4249bb76cda5c9314c4e6 (patch)
treef0910e57f64d1638f00bf7f6449d479fb377bfac /js/helper-classes
parent16decc5726eafbb25675c61be6df85a378ac1fac (diff)
downloadninja-5914c5b2209c4b8daac4249bb76cda5c9314c4e6.tar.gz
Cleaning up referencing to 'documentRoot' and '_document'
Moved to reference new model in DOM architecture rework. This should not affect anything, just moving the references, and also the setting to the render methods in the design view.
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js12
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js6
-rwxr-xr-xjs/helper-classes/3D/view-utils.js44
3 files changed, 31 insertions, 31 deletions
<
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index bf48a723..9de85216 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -124,7 +124,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
124 this._eltArray = []; 124 this._eltArray = [];
125 this._planesArray = []; 125 this._planesArray = [];
126 this.setDrawingSurfaceElement(stage.canvas); 126 this.setDrawingSurfaceElement(stage.canvas);
127 this.setSourceSpaceElement( this.application.ninja.currentDocument.documentRoot); 127 this.setSourceSpaceElement( this.application.ninja.currentDocument.model.documentRoot);
128 this.setWorkingPlane( [0,0,1,0] ); 128 this.setWorkingPlane( [0,0,1,0] );
129 129
130 //Loop through all the top-level children of the current document and call drawUtils.addElement on them 130 //Loop through all the top-level children of the current document and call drawUtils.addElement on them
@@ -697,7 +697,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
697 this._lineColor = saveColor; 697 this._lineColor = saveColor;
698 this._drawingContext.lineWidth = saveLineWidth; 698 this._drawingContext.lineWidth = saveLineWidth;
699 699
700 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { 700 if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") {
701 // draw an outline around the body 701 // draw an outline around the body
702 var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); 702 var stagePt = MathUtils.getPointOnPlane([0,0,1,0]);
703 var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); 703 var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt);
@@ -815,7 +815,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
815 // draw the lines 815 // draw the lines
816 var line, 816 var line,
817 nLines = this._gridLineArray.length; 817 nLines = this._gridLineArray.length;
818 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { 818 if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") {
819 nLines = this._gridLineArray.length-4; 819 nLines = this._gridLineArray.length-4;
820 } 820 }
821 821
@@ -824,7 +824,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
824 this.drawIntersectedLine(line, this._drawingContext); 824 this.drawIntersectedLine(line, this._drawingContext);
825 } 825 }
826 826
827 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { 827 if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") {
828 this._lineColor = "red"; 828 this._lineColor = "red";
829 i = nLines; 829 i = nLines;
830 nLines += 4; 830 nLines += 4;
@@ -923,7 +923,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 923 // if all of the planes are aligned, check if they are aligned with the view direction
924 if (flat) 924 if (flat)
925 { 925 {
926 var stage = this.application.ninja.currentDocument.documentRoot; 926 var stage = this.application.ninja.currentDocument.model.documentRoot;
927 var stageMat = this.viewUtils.getMatrixFromElement(stage); 927 var stageMat = this.viewUtils.getMatrixFromElement(stage);
928 var viewDir = [ stageMat[8], stageMat[9], stageMat[10] ]; 928 var viewDir = [ stageMat[8], stageMat[9], stageMat[10] ];
929 viewDir = vecUtils.vecNormalize( 3, viewDir ); 929 viewDir = vecUtils.vecNormalize( 3, viewDir );
@@ -1213,7 +1213,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
1213 value: function() { 1213 value: function() {
1214 // set the element to be the viewport object - temporarily 1214 // set the element to be the viewport object - temporarily
1215 var tmpCanvas = this.application.ninja.stage.canvas; 1215 var tmpCanvas = this.application.ninja.stage.canvas;
1216 var tmpStage = this.application.ninja.currentDocument.documentRoot; 1216 var tmpStage = this.application.ninja.currentDocument.model.documentRoot;
1217 this.viewUtils.pushViewportObj( tmpCanvas ); 1217 this.viewUtils.pushViewportObj( tmpCanvas );
1218 1218
1219 // save the source space object and set to the target object 1219 // 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..d937e897 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; }},
diff --git a/js/helper-classes/3D/view-utils.js b/js/helper-classes/3D/view-utils.js
index 0080bf90..f5ab7172 100755
--- a/js/helper-classes/3D/view-utils.js
+++ b/js/helper-classes/3D/view-utils.js
@@ -126,7 +126,7 @@ exports.ViewUtils = Montage.create(Component, {
126 var yVec = [0,1,0]; 126 var yVec = [0,1,0];
127 var zVec = [0,0,1]; 127 var zVec = [0,0,1];
128 128
129 var stage = this.application.ninja.currentDocument.documentRoot; 129 var stage = this.application.ninja.currentDocument.model.documentRoot;
130 var stageMat = this.getMatrixFromElement(stage); 130 var stageMat = this.getMatrixFromElement(stage);
131 131
132 var mat = glmat4.multiply( stageMat, objMat, [] ); 132 var mat = glmat4.multiply( stageMat, objMat, [] );
@@ -286,7 +286,7 @@ exports.ViewUtils = Montage.create(Component, {
286 // into stage world space. 286 // into stage world space.
287 postViewToStageWorld: { 287 postViewToStageWorld: {
288 value: function( localPt, elt ) { 288 value: function( localPt, elt ) {
289 if ((elt == null) || (elt === this.application.ninja.currentDocument.documentRoot)) return localPt; 289 if ((elt == null) || (elt === this.application.ninja.currentDocument.model.documentRoot)) return localPt;
290 290
291 // get the 3D transformation and 2D offset from the element 291 // get the 3D transformation and 2D offset from the element
292 var pt = localPt.slice(0); 292 var pt = localPt.slice(0);
@@ -313,7 +313,7 @@ exports.ViewUtils = Montage.create(Component, {
313 this.popViewportObj(); 313 this.popViewportObj();
314 314
315 // check if we are done 315 // check if we are done
316 if (parent === this.application.ninja.currentDocument.documentRoot) break; 316 if (parent === this.application.ninja.currentDocument.model.documentRoot) break;
317 317
318 if (this.elementHas3D( parent )) 318 if (this.elementHas3D( parent ))
319 { 319 {
@@ -342,13 +342,13 @@ exports.ViewUtils = Montage.create(Component, {
342 { 342 {
343 pt = this.childToParent( pt, child ); 343 pt = this.childToParent( pt, child );
344 344
345// if (child === this.application.ninja.currentDocument.documentRoot) break; 345// if (child === this.application.ninja.currentDocument.model.documentRoot) break;
346// child = child.offsetParent; 346// child = child.offsetParent;
347 347
348 if (child === this.application.ninja.currentDocument.documentRoot) break; 348 if (child === this.application.ninja.currentDocument.model.documentRoot) break;
349 if (child === this.application.ninja.currentDocument.documentRoot.parentNode) break; 349 if (child === this.application.ninja.currentDocument.model.documentRoot.parentNode) break;
350 child = child.offsetParent; 350 child = child.offsetParent;
351 if (child === this.application.ninja.currentDocument.documentRoot.parentNode) break; 351 if (child === this.application.ninja.currentDocument.model.documentRoot.parentNode) break;
352 } 352 }
353 353
354 ///////////////////////////////////////////////////////// 354 /////////////////////////////////////////////////////////
@@ -385,7 +385,7 @@ exports.ViewUtils = Montage.create(Component, {
385 // transform the bounds up the tree 385 // transform the bounds up the tree
386 var parent = child.offsetParent; 386 var parent = child.offsetParent;
387 // TODO - Should have a different way to check for new template mode 387 // TODO - Should have a different way to check for new template mode
388 if ( parent || ((child === this.application.ninja.currentDocument.documentRoot) && (child.id !== "UserContent")) ) 388 if ( parent || ((child === this.application.ninja.currentDocument.model.documentRoot) && (child.id !== "UserContent")) )
389 { 389 {
390 this.setViewportObj( child ); 390 this.setViewportObj( child );
391 391
@@ -398,7 +398,7 @@ exports.ViewUtils = Montage.create(Component, {
398 { 398 {
399 // TODO - Commenting out flatten support until new perspective workflow is fully working 399 // TODO - Commenting out flatten support until new perspective workflow is fully working
400 // if (flatten) pt[2] = 0; 400 // if (flatten) pt[2] = 0;
401// var flatten = (parent !== this.application.ninja.currentDocument.documentRoot.parentNode) && (ElementsMediator.getProperty(parent, "-webkit-transform-style") !== "preserve-3d"); 401// var flatten = (parent !== this.application.ninja.currentDocument.model.documentRoot.parentNode) && (ElementsMediator.getProperty(parent, "-webkit-transform-style") !== "preserve-3d");
402// if(flatten) 402// if(flatten)
403// { 403// {
404// pt[2] = 0; 404// pt[2] = 0;
@@ -458,7 +458,7 @@ exports.ViewUtils = Montage.create(Component, {
458 // get the four corners of the element in global space 458 // get the four corners of the element in global space
459 var bounds = this.getElementViewBounds3D( elt ); 459 var bounds = this.getElementViewBounds3D( elt );
460 var bounds3D = new Array(); 460 var bounds3D = new Array();
461 var stage = this.application.ninja.currentDocument.documentRoot; 461 var stage = this.application.ninja.currentDocument.model.documentRoot;
462 for (var i=0; i<3; i++) 462 for (var i=0; i<3; i++)
463 { 463 {
464 var gPt = this.localToGlobal( bounds[i], elt ); 464 var gPt = this.localToGlobal( bounds[i], elt );
@@ -683,7 +683,7 @@ exports.ViewUtils = Montage.create(Component, {
683 // if (elt.__ninjaXOff) xOff = elt.__ninjaXOff; 683 // if (elt.__ninjaXOff) xOff = elt.__ninjaXOff;
684 // if (elt.__ninjaYOff) yOff = elt.__ninjaYOff; 684 // if (elt.__ninjaYOff) yOff = elt.__ninjaYOff;
685 var offset = [xOff, yOff]; 685 var offset = [xOff, yOff];
686 if(elt.offsetParent && (elt.offsetParent !== this.application.ninja.currentDocument.documentRoot)) 686 if(elt.offsetParent && (elt.offsetParent !== this.application.ninja.currentDocument.model.documentRoot))
687 { 687 {
688 var pS = elt.ownerDocument.defaultView.getComputedStyle(elt.offsetParent); 688 var pS = elt.ownerDocument.defaultView.getComputedStyle(elt.offsetParent);
689 689
@@ -699,7 +699,7 @@ exports.ViewUtils = Montage.create(Component, {
699 } 699 }
700 } 700 }
701 701
702 if(elt === this.application.ninja.currentDocument.documentRoot) 702 if(elt === this.application.ninja.currentDocument.model.documentRoot)
703 { 703 {
704 // TODO - Call a routine from the user document controller to get the offsets/margins 704