diff options
author | Nivesh Rajbhandari | 2012-05-24 13:54:00 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-05-24 13:54:00 -0700 |
commit | fd4af6d81725dfa0630ac5e52ba95405336f4074 (patch) | |
tree | 868197f79862e98b9c7f5a1f296d64832c68d48f /js/helper-classes/3D/view-utils.js | |
parent | de25d2b7d05476d4f0d385b5e910db189f682d21 (diff) | |
parent | 70ff8dd670bc37c14caf850e06791d1e293b1e4b (diff) | |
download | ninja-fd4af6d81725dfa0630ac5e52ba95405336f4074.tar.gz |
Merge branch 'refs/heads/dom-architecture-master' into Dom-Architecture
Diffstat (limited to 'js/helper-classes/3D/view-utils.js')
-rwxr-xr-x | js/helper-classes/3D/view-utils.js | 44 |
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 24b30298..a3d09404 100755 --- a/js/helper-classes/3D/view-utils.js +++ b/js/helper-classes/3D/view-utils.js | |||
@@ -120,7 +120,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
120 | var yVec = [0,1,0]; | 120 | var yVec = [0,1,0]; |
121 | var zVec = [0,0,1]; | 121 | var zVec = [0,0,1]; |
122 | 122 | ||
123 | var stage = this.application.ninja.currentDocument.documentRoot; | 123 | var stage = this.application.ninja.currentDocument.model.documentRoot; |
124 | var stageMat = this.getMatrixFromElement(stage); | 124 | var stageMat = this.getMatrixFromElement(stage); |
125 | 125 | ||
126 | var mat = glmat4.multiply( stageMat, objMat, [] ); | 126 | var mat = glmat4.multiply( stageMat, objMat, [] ); |
@@ -280,7 +280,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
280 | // into stage world space. | 280 | // into stage world space. |
281 | postViewToStageWorld: { | 281 | postViewToStageWorld: { |
282 | value: function( localPt, elt ) { | 282 | value: function( localPt, elt ) { |
283 | if ((elt == null) || (elt === this.application.ninja.currentDocument.documentRoot)) return localPt; | 283 | if ((elt == null) || (elt === this.application.ninja.currentDocument.model.documentRoot)) return localPt; |
284 | 284 | ||
285 | // get the 3D transformation and 2D offset from the element | 285 | // get the 3D transformation and 2D offset from the element |
286 | var pt = localPt.slice(0); | 286 | var pt = localPt.slice(0); |
@@ -307,7 +307,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
307 | this.popViewportObj(); | 307 | this.popViewportObj(); |
308 | 308 | ||
309 | // check if we are done | 309 | // check if we are done |
310 | if (parent === this.application.ninja.currentDocument.documentRoot) break; | 310 | if (parent === this.application.ninja.currentDocument.model.documentRoot) break; |
311 | 311 | ||
312 | if (this.elementHas3D( parent )) | 312 | if (this.elementHas3D( parent )) |
313 | { | 313 | { |
@@ -336,13 +336,13 @@ exports.ViewUtils = Montage.create(Component, { | |||
336 | { | 336 | { |
337 | pt = this.childToParent( pt, child ); | 337 | pt = this.childToParent( pt, child ); |
338 | 338 | ||
339 | // if (child === this.application.ninja.currentDocument.documentRoot) break; | 339 | // if (child === this.application.ninja.currentDocument.model.documentRoot) break; |
340 | // child = child.offsetParent; | 340 | // child = child.offsetParent; |
341 | 341 | ||
342 | if (child === this.application.ninja.currentDocument.documentRoot) break; | 342 | if (child === this.application.ninja.currentDocument.model.documentRoot) break; |
343 | if (child === this.application.ninja.currentDocument.documentRoot.parentNode) break; | 343 | if (child === this.application.ninja.currentDocument.model.documentRoot.parentNode) break; |
344 | child = child.offsetParent; | 344 | child = child.offsetParent; |
345 | if (child === this.application.ninja.currentDocument.documentRoot.parentNode) break; | 345 | if (child === this.application.ninja.currentDocument.model.documentRoot.parentNode) break; |
346 | } | 346 | } |
347 | 347 | ||
348 | ///////////////////////////////////////////////////////// | 348 | ///////////////////////////////////////////////////////// |
@@ -379,7 +379,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
379 | // transform the bounds up the tree | 379 | // transform the bounds up the tree |
380 | var parent = child.offsetParent; | 380 | var parent = child.offsetParent; |
381 | // TODO - Should have a different way to check for new template mode | 381 | // TODO - Should have a different way to check for new template mode |
382 | if ( parent || (child === this.application.ninja.currentDocument.documentRoot) ) | 382 | if ( parent || (child === this.application.ninja.currentDocument.model.documentRoot) ) |
383 | { | 383 | { |
384 | this.setViewportObj( child ); | 384 | this.setViewportObj( child ); |
385 | 385 | ||
@@ -392,7 +392,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
392 | { | 392 | { |
393 | // TODO - Commenting out flatten support until new perspective workflow is fully working | 393 | // TODO - Commenting out flatten support until new perspective workflow is fully working |
394 | // if (flatten) pt[2] = 0; | 394 | // if (flatten) pt[2] = 0; |
395 | // var flatten = (parent !== this.application.ninja.currentDocument.documentRoot.parentNode) && (ElementsMediator.getProperty(parent, "-webkit-transform-style") !== "preserve-3d"); | 395 | // var flatten = (parent !== this.application.ninja.currentDocument.model.documentRoot.parentNode) && (ElementsMediator.getProperty(parent, "-webkit-transform-style") !== "preserve-3d"); |
396 | // if(flatten) | 396 | // if(flatten) |
397 | // { | 397 | // { |
398 | // pt[2] = 0; | 398 | // pt[2] = 0; |
@@ -452,7 +452,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
452 | // get the four corners of the element in global space | 452 | // get the four corners of the element in global space |
453 | var bounds = this.getElementViewBounds3D( elt ); | 453 | var bounds = this.getElementViewBounds3D( elt ); |
454 | var bounds3D = new Array(); | 454 | var bounds3D = new Array(); |
455 | var stage = this.application.ninja.currentDocument.documentRoot; | 455 | var stage = this.application.ninja.currentDocument.model.documentRoot; |
456 | for (var i=0; i<3; i++) | 456 | for (var i=0; i<3; i++) |
457 | { | 457 | { |
458 | var gPt = this.localToGlobal( bounds[i], elt ); | 458 | var gPt = this.localToGlobal( bounds[i], elt ); |
@@ -677,7 +677,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
677 | // if (elt.__ninjaXOff) xOff = elt.__ninjaXOff; | 677 | // if (elt.__ninjaXOff) xOff = elt.__ninjaXOff; |
678 | // if (elt.__ninjaYOff) yOff = elt.__ninjaYOff; | 678 | // if (elt.__ninjaYOff) yOff = elt.__ninjaYOff; |
679 | var offset = [xOff, yOff]; | 679 | var offset = [xOff, yOff]; |
680 | if(elt.offsetParent && (elt.offsetParent !== this.application.ninja.currentDocument.documentRoot)) | 680 | if(elt.offsetParent && (elt.offsetParent !== this.application.ninja.currentDocument.model.documentRoot)) |
681 | { | 681 | { |
682 | var pS = elt.ownerDocument.defaultView.getComputedStyle(elt.offsetParent); | 682 | var pS = elt.ownerDocument.defaultView.getComputedStyle(elt.offsetParent); |
683 | 683 | ||
@@ -693,7 +693,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
693 | } | 693 | } |
694 | } | 694 | } |
695 | 695 | ||
696 | if(elt === this.application.ninja.currentDocument.documentRoot) | 696 | if(elt === this.application.ninja.currentDocument.model.documentRoot) |
697 | { | 697 | { |
698 | // TODO - Call a routine from the user document controller to get the offsets/margins | 698 | // TODO - Call a routine from the user document controller to get the offsets/margins |
699 | // Once we expose the document controller to ViewUtils | 699 | // Once we expose the document controller to ViewUtils |
@@ -870,7 +870,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
870 | { | 870 | { |
871 | value: function() | 871 | value: function() |
872 | { | 872 | { |
873 | var stage = this.application.ninja.currentDocument.documentRoot; | 873 | var stage = this.application.ninja.currentDocument.model.documentRoot; |
874 | 874 | ||
875 | this.pushViewportObj( stage ); | 875 | this.pushViewportObj( stage ); |
876 | // put the point into screen space of the stage - requires | 876 | // put the point into screen space of the stage - requires |
@@ -984,7 +984,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
984 | glmat4.multiply( v2s, mat, mat ); | 984 | glmat4.multiply( v2s, mat, mat ); |
985 | 985 | ||
986 | // TODO - Commenting out flatten support until new perspective workflow is fully working | 986 | // TODO - Commenting out flatten support until new perspective workflow is fully working |
987 | // 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"); | 987 | // 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"); |
988 | // if(flatten) | 988 | // if(flatten) |
989 | // { | 989 | // { |
990 | // glmat4.multiply( zMat, mat, mat ); | 990 | // glmat4.multiply( zMat, mat, mat ); |
@@ -998,10 +998,10 @@ exports.ViewUtils = Montage.create(Component, { | |||
998 | 998 | ||
999 | this.popViewportObj(); | 999 | this.popViewportObj(); |
1000 | 1000 | ||
1001 | if (elt === this.application.ninja.currentDocument.documentRoot) break; | 1001 | if (elt === this.application.ninja.currentDocument.model.documentRoot) break; |
1002 | if (elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; | 1002 | if (elt === this.application.ninja.currentDocument.model.documentRoot.parentNode) break; |
1003 | elt = elt.offsetParent; | 1003 | elt = elt.offsetParent; |
1004 | if (elt === this.application.ninja.currentDocument.documentRoot.parentNode) break; | 1004 | if (elt === this.application.ninja.currentDocument.model.documentRoot.parentNode) break; |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | return mat; | 1007 | return mat; |
@@ -1035,7 +1035,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
1035 | // multiply all the matrices together | 1035 | // multiply all the matrices together |
1036 | //mat = s2v.multiply( mat ); | 1036 | //mat = s2v.multiply( mat ); |
1037 | glmat4.multiply( s2v, mat, mat ); | 1037 | glmat4.multiply( s2v, mat, mat ); |
1038 | if (elt === this.application.ninja.currentDocument.documentRoot) break; | 1038 | if (elt === this.application.ninja.currentDocument.model.documentRoot) break; |
1039 | //mat = objMat.multiply( mat ); | 1039 | //mat = objMat.multiply( mat ); |
1040 | glmat4.multiply( objMat, mat, mat ); | 1040 | glmat4.multiply( objMat, mat, mat ); |
1041 | if(shouldProject && pDist) | 1041 | if(shouldProject && pDist) |
@@ -1084,7 +1084,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
1084 | // multiply all the matrices together | 1084 | // multiply all the matrices together |
1085 | //mat = s2v.multiply( mat ); | 1085 | //mat = s2v.multiply( mat ); |
1086 | glmat4.multiply( s2v, mat, mat ); | 1086 | glmat4.multiply( s2v, mat, mat ); |
1087 | if (elt === this.application.ninja.currentDocument.documentRoot) break; | 1087 | if (elt === this.application.ninja.currentDocument.model.documentRoot) break; |
1088 | //mat = objMat.multiply( mat ); | 1088 | //mat = objMat.multiply( mat ); |
1089 | if (shouldLocalTransform) { | 1089 | if (shouldLocalTransform) { |
1090 | glmat4.multiply( objMat, mat, mat ); | 1090 | glmat4.multiply( objMat, mat, mat ); |
@@ -1271,7 +1271,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
1271 | // | 1271 | // |
1272 | // STAGE ACCESSORS: | 1272 | // STAGE ACCESSORS: |
1273 | // activeDocument: this.application.ninja.currentDocument | 1273 | // activeDocument: this.application.ninja.currentDocument |
1274 | // userContent (stage): this.application.ninja.currentDocument.documentRoot | 1274 | // userContent (stage): this.application.ninja.currentDocument.model.documentRoot |
1275 | // stageManager: this.application.ninja.stage // MainApp\js\stage\stage.reel\stage.js | 1275 | // stageManager: this.application.ninja.stage // MainApp\js\stage\stage.reel\stage.js |
1276 | // stageManager._canvas: this.application.ninja.stage.canvas | 1276 | // stageManager._canvas: this.application.ninja.stage.canvas |
1277 | // stageManager.layoutCanvas: this.application.ninja.stage.layoutCanvas | 1277 | // stageManager.layoutCanvas: this.application.ninja.stage.layoutCanvas |
@@ -1305,7 +1305,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
1305 | if (this.application.ninja.currentDocument) | 1305 | if (this.application.ninja.currentDocument) |
1306 | { | 1306 | { |
1307 | // get the user content object | 1307 | // get the user content object |
1308 | var userContent = this.application.ninja.currentDocument.documentRoot; | 1308 | var userContent = this.application.ninja.currentDocument.model.documentRoot; |
1309 | if (!userContent) return; | 1309 | if (!userContent) return; |
1310 | this.setViewportObj( userContent ); | 1310 | this.setViewportObj( userContent ); |
1311 | 1311 | ||
@@ -1335,7 +1335,7 @@ exports.ViewUtils = Montage.create(Component, { | |||
1335 | 1335 | ||
1336 | if (this.application.ninja.currentDocument) | 1336 | if (this.application.ninja.currentDocument) |
1337 | { | 1337 | { |
1338 | var userContent = this.application.ninja.currentDocument.documentRoot; | 1338 | var userContent = this.application.ninja.currentDocument.model.documentRoot; |
1339 | if (!userContent) return; | 1339 | if (!userContent) return; |
1340 | this.setViewportObj( userContent ); |