diff options
author | Valerio Virgillito | 2012-05-24 11:59:17 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-05-24 11:59:17 -0700 |
commit | 70ff8dd670bc37c14caf850e06791d1e293b1e4b (patch) | |
tree | 8e00a27c6c908dda3e816d1f5aaf0d2a889ca5dc /js/helper-classes/3D | |
parent | a8eb5c65a21af3bf8d8b8eb3e65b494b8bd9bc01 (diff) | |
parent | a6db492176a85546047dae6d5ecb9cfc4325e043 (diff) | |
download | ninja-70ff8dd670bc37c14caf850e06791d1e293b1e4b.tar.gz |
Merge pull request #255 from joseeight/Document
Cleaning up referencing to documentRoot
Diffstat (limited to 'js/helper-classes/3D')
-rwxr-xr-x | js/helper-classes/3D/draw-utils.js | 12 | ||||
-rwxr-xr-x | js/helper-classes/3D/snap-manager.js | 6 | ||||
-rwxr-xr-x | js/helper-classes/3D/view-utils.js | 44 |
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 79be5c14..871b832d 100755 --- a/js/helper-classes/3D/draw-utils.js +++ b/js/helper-classes/3D/draw-utils.js | |||
@@ -127,7 +127,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
127 | this._eltArray = []; | 127 | this._eltArray = []; |
128 | this._planesArray = []; | 128 | this._planesArray = []; |
129 | this.setDrawingSurfaceElement(stage.canvas); | 129 | this.setDrawingSurfaceElement(stage.canvas); |
130 | this.setSourceSpaceElement( this.application.ninja.currentDocument.documentRoot); | 130 | this.setSourceSpaceElement( this.application.ninja.currentDocument.model.documentRoot); |
131 | this.setWorkingPlane( [0,0,1,0] ); | 131 | this.setWorkingPlane( [0,0,1,0] ); |
132 | 132 | ||
133 | //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 |
@@ -700,7 +700,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
700 | this._lineColor = saveColor; | 700 | this._lineColor = saveColor; |
701 | this._drawingContext.lineWidth = saveLineWidth; | 701 | this._drawingContext.lineWidth = saveLineWidth; |
702 | 702 | ||
703 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | 703 | if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { |
704 | // draw an outline around the body | 704 | // draw an outline around the body |
705 | var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); | 705 | var stagePt = MathUtils.getPointOnPlane([0,0,1,0]); |
706 | var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); | 706 | var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt); |
@@ -818,7 +818,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
818 | // draw the lines | 818 | // draw the lines |
819 | var line, | 819 | var line, |
820 | nLines = this._gridLineArray.length; | 820 | nLines = this._gridLineArray.length; |
821 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | 821 | if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { |
822 | nLines = this._gridLineArray.length-4; | 822 | nLines = this._gridLineArray.length-4; |
823 | } | 823 | } |
824 | 824 | ||
@@ -827,7 +827,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
827 | this.drawIntersectedLine(line, this._drawingContext); | 827 | this.drawIntersectedLine(line, this._drawingContext); |
828 | } | 828 | } |
829 | 829 | ||
830 | if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent") { | 830 | if(this.application.ninja.currentDocument.model.documentRoot.id !== "UserContent") { |
831 | this._lineColor = "red"; | 831 | this._lineColor = "red"; |
832 | i = nLines; | 832 | i = nLines; |
833 | nLines += 4; | 833 | nLines += 4; |
@@ -926,7 +926,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
926 | // 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 |
927 | if (flat) | 927 | if (flat) |
928 | { | 928 | { |
929 | var stage = this.application.ninja.currentDocument.documentRoot; | 929 | var stage = this.application.ninja.currentDocument.model.documentRoot; |
930 | var stageMat = this.viewUtils.getMatrixFromElement(stage); | 930 | var stageMat = this.viewUtils.getMatrixFromElement(stage); |
931 | var viewDir = [ stageMat[8], stageMat[9], stageMat[10] ]; | 931 | var viewDir = [ stageMat[8], stageMat[9], stageMat[10] ]; |
932 | viewDir = vecUtils.vecNormalize( 3, viewDir ); | 932 | viewDir = vecUtils.vecNormalize( 3, viewDir ); |
@@ -1216,7 +1216,7 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, { | |||
1216 | value: function() { | 1216 | value: function() { |
1217 | // set the element to be the viewport object - temporarily | 1217 | // set the element to be the viewport object - temporarily |
1218 | var tmpCanvas = this.application.ninja.stage.canvas; | 1218 | var tmpCanvas = this.application.ninja.stage.canvas; |
1219 | var tmpStage = this.application.ninja.currentDocument.documentRoot; | 1219 | var tmpStage = this.application.ninja.currentDocument.model.documentRoot; |
1220 | this.viewUtils.pushViewportObj( tmpCanvas ); | 1220 | this.viewUtils.pushViewportObj( tmpCanvas ); |
1221 | 1221 | ||
1222 | // 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 f0f8dbe4..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; }}, |
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 | // T |