aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/3D/view-utils.js
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/3D/view-utils.js
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/3D/view-utils.js')
-rwxr-xr-xjs/helper-classes/3D/view-utils.js44
1 files changed, 22 insertions, 22 deletions
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 // TODO - Call a routine from the user document controller to get the offsets/margins
705 // Once we expose the document controller to ViewUtils 705 // Once we expose the document controller to ViewUtils
@@ -876,7 +876,7 @@ exports.ViewUtils = Montage.create(Component, {
876 { 876 {
877 value: function() 877 value: function()
878 { 878 {
879 var stage = this.application.ninja.currentDocument.documentRoot; 879 var stage = this.application.ninja.currentDocument.model.documentRoot;
880 880
881 this.pushViewportObj( stage ); 881 this.pushViewportObj( stage );
882 // put the point into screen space of the stage - requires 882 // put the point into screen space of the stage - requires
@@ -990,7 +990,7 @@ exports.ViewUtils = Montage.create(Component, {
990 glmat4.multiply( v2s, mat, mat ); 990 glmat4.multiply( v2s, mat, mat );
991 991
992 // TODO - Commenting out flatten support until new perspective workflow is fully working 992 // TODO - Commenting out flatten support until new perspective workflow is fully working
993// var flatten = (elt !== this.application.ninja.currentDocument.documentRoot.parentNode) && (elt.parentElement !== this.application.ninja.currentDocument.documentRoot.parentNode) && (ElementsMediator.getProperty(elt.parentElement, "-webkit-transform-style") !== "preserve-3d"); 993// var flatten = (elt !== this.application.ninja.currentDocument.model.documentRoot.parentNode) && (elt.parentElement !== this.application.ninja.currentDocument.model.documentRoot.parentNode) && (ElementsMediator.getProperty(elt.parentElement, "-webkit-transform-style") !== "preserve-3d");
994// if(flatten) 994// if(flatten)
995// { 995// {
996// glmat4.multiply( zMat, mat, mat ); 996// glmat4.multiply( zMat, mat, mat );
@@ -1004,10 +1004,10 @@ exports.ViewUtils = Montage.create(Component, {
1004 1004
1005 this.popViewportObj(); 1005 this.popViewportObj();
1006 1006
1007 if (elt === this.application.ninja.currentDocument.documentRoot) break; 1007 if (elt === this.application.ninja.currentDocument.model.documentRoot) break;
1008 if (elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; 1008 if (elt === this.application.ninja.currentDocument.model.documentRoot.parentNode) break;
1009 elt = elt.offsetParent; 1009 elt = elt.offsetParent;
1010 if (elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; 1010 if (elt === this.application.ninja.currentDocument.model.documentRoot.parentNode) break;
1011 } 1011 }
1012 1012
1013 return mat; 1013 return mat;
@@ -1041,7 +1041,7 @@ exports.ViewUtils = Montage.create(Component, {
1041 // multiply all the matrices together 1041 // multiply all the matrices together
1042 //mat = s2v.multiply( mat ); 1042 //mat = s2v.multiply( mat );
1043 glmat4.multiply( s2v, mat, mat ); 1043 glmat4.multiply( s2v, mat, mat );
1044 if (elt === this.application.ninja.currentDocument.documentRoot) break; 1044 if (elt === this.application.ninja.currentDocument.model.documentRoot) break;
1045 //mat = objMat.multiply( mat ); 1045 //mat = objMat.multiply( mat );
1046 glmat4.multiply( objMat, mat, mat ); 1046 glmat4.multiply( objMat, mat, mat );
1047 if(shouldProject && pDist) 1047 if(shouldProject && pDist)
@@ -1090,7 +1090,7 @@ exports.ViewUtils = Montage.create(Component, {
1090 // multiply all the matrices together 1090 // multiply all the matrices together
1091 //mat = s2v.multiply( mat ); 1091 //mat = s2v.multiply( mat );
1092 glmat4.multiply( s2v, mat, mat ); 1092 glmat4.multiply( s2v, mat, mat );
1093 if (elt === this.application.ninja.currentDocument.documentRoot) break; 1093 if (elt === this.application.ninja.currentDocument.model.documentRoot) break;
1094 //mat = objMat.multiply( mat ); 1094 //mat = objMat.multiply( mat );
1095 if (shouldLocalTransform) { 1095 if (shouldLocalTransform) {
1096 glmat4.multiply( objMat, mat, mat ); 1096 glmat4.multiply( objMat, mat, mat );
@@ -1277,7 +1277,7 @@ exports.ViewUtils = Montage.create(Component, {
1277// 1277//
1278// STAGE ACCESSORS: 1278// STAGE ACCESSORS:
1279// activeDocument: this.application.ninja.currentDocument 1279// activeDocument: this.application.ninja.currentDocument
1280// userContent (stage): this.application.ninja.currentDocument.documentRoot 1280// userContent (stage): this.application.ninja.currentDocument.model.documentRoot
1281// stageManager: this.application.ninja.stage // MainApp\js\stage\stage.reel\stage.js 1281// stageManager: this.application.ninja.stage // MainApp\js\stage\stage.reel\stage.js
1282// stageManager._canvas: this.application.ninja.stage.canvas 1282// stageManager._canvas: this.application.ninja.stage.canvas
1283// stageManager.layoutCanvas: this.application.ninja.stage.layoutCanvas 1283// stageManager.layoutCanvas: this.application.ninja.stage.layoutCanvas
@@ -1312,7 +1312,7 @@ exports.ViewUtils = Montage.create(Component, {
1312 if (this.application.ninja.currentDocument) 1312 if (this.application.ninja.currentDocument)
1313 { 1313 {
1314 // get the user content object 1314 // get the user content object
1315 var userContent = this.application.ninja.currentDocument.documentRoot; 1315 var userContent = this.application.ninja.currentDocument.model.documentRoot;
1316 if (!userContent) return; 1316 if (!userContent) return;
1317 this.setViewportObj( userContent ); 1317 this.setViewportObj( userContent );
1318 1318
@@ -1342,7 +1342,7 @@ exports.ViewUtils = Montage.create(Component, {
1342 1342
1343 if (this.application.ninja.currentDocument) 1343 if (this.application.ninja.currentDocument)
1344 { 1344 {
1345 var userContent = this.application.ninja.currentDocument.documentRoot; 1345 var userContent = this.application.ninja.currentDocument.model.documentRoot;
1346 if (!userContent) return; 1346 if (!userContent) return;
1347 this.setViewportObj( userContent ); 1347 this.setViewportObj( userContent );<