From 5914c5b2209c4b8daac4249bb76cda5c9314c4e6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 24 May 2012 00:07:23 -0700 Subject: 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. --- js/tools/PanTool.js | 16 ++++++++-------- js/tools/Rotate3DToolBase.js | 12 ++++++------ js/tools/RotateStage3DTool.js | 8 ++++---- js/tools/SelectionTool.js | 6 +++--- js/tools/Translate3DToolBase.js | 4 ++-- js/tools/ZoomTool.js | 2 +- js/tools/drawing-tool-base.js | 12 ++++++------ js/tools/modifier-tool-base.js | 8 ++++---- 8 files changed, 34 insertions(+), 34 deletions(-) (limited to 'js/tools') diff --git a/js/tools/PanTool.js b/js/tools/PanTool.js index 5cfeec75..39f89d17 100755 --- a/js/tools/PanTool.js +++ b/js/tools/PanTool.js @@ -47,8 +47,8 @@ exports.PanTool = Montage.create(toolBase, HandleLeftButtonDown: { value : function ( event ) { // Determine the maximum horizontal and vertical scroll values - this._maxHorizontalScroll = this.application.ninja.currentDocument.documentRoot.scrollWidth - this.application.ninja.stage._canvas.width - 11; - this._maxVerticalScroll = this.application.ninja.currentDocument.documentRoot.scrollHeight - this.application.ninja.stage._canvas.height - 11; + this._maxHorizontalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollWidth - this.application.ninja.stage._canvas.width - 11; + this._maxVerticalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollHeight - this.application.ninja.stage._canvas.height - 11; if((this._maxHorizontalScroll > 0) || (this._maxVerticalScroll > 0) || this._altKeyDown) { this._isDrawing = true; @@ -121,7 +121,7 @@ exports.PanTool = Montage.create(toolBase, { value: function () { - var uc = this.application.ninja.currentDocument.documentRoot; + var uc = this.application.ninja.currentDocument.model.documentRoot; //var uc = documentManagerModule.DocumentManager.activeDocument var ucMat = viewUtils.getMatrixFromElement(uc); @@ -152,7 +152,7 @@ exports.PanTool = Montage.create(toolBase, delta *= zoom; - var uc = this.application.ninja.currentDocument.documentRoot; + var uc = this.application.ninja.currentDocument.model.documentRoot; var ucMat = viewUtils.getMatrixFromElement(uc); var offset = viewUtils.getElementOffset( uc ); //console.log( "uc offset: " + offset[0] ); @@ -224,7 +224,7 @@ exports.PanTool = Montage.create(toolBase, if (elt) { // get the userContent object (stage) and its matrix - var userContent = this.application.ninja.currentDocument.documentRoot; + var userContent = this.application.ninja.currentDocument.model.documentRoot; var ucMat = viewUtils.getMatrixFromElement(userContent); var localToGlobalMat = viewUtils.getLocalToGlobalMatrix( elt ); @@ -358,7 +358,7 @@ exports.PanTool = Montage.create(toolBase, delta[2] = 0; // limit the change - var ucMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.documentRoot); + var ucMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.model.documentRoot); var tooMuch = false; if ((ucMat[12] > 12000) && (delta[0] > 0)) tooMuch = true; if ((ucMat[12] < -12000) && (delta[0] < 0)) tooMuch = true; @@ -397,7 +397,7 @@ exports.PanTool = Montage.create(toolBase, value: function( transMat ) { // update the user content matrix - var uc = this.application.ninja.currentDocument.documentRoot; + var uc = this.application.ninja.currentDocument.model.documentRoot; var ucMat = viewUtils.getMatrixFromElement(uc); var newUCMat = glmat4.multiply( transMat, ucMat, [] ); viewUtils.setMatrixForElement( uc, newUCMat ); @@ -412,7 +412,7 @@ exports.PanTool = Montage.create(toolBase, value: function() { // get the userContent object - var userContent = this.application.ninja.currentDocument.documentRoot; + var userContent = this.application.ninja.currentDocument.model.documentRoot; // get a matrix from user content world space to the screen viewUtils.pushViewportObj( userContent ); diff --git a/js/tools/Rotate3DToolBase.js b/js/tools/Rotate3DToolBase.js index 4fa8657e..bf9537dd 100755 --- a/js/tools/Rotate3DToolBase.js +++ b/js/tools/Rotate3DToolBase.js @@ -32,7 +32,7 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, { var selectedElements = this.application.ninja.selectedElements; if(this.rotateStage) { - selectedElements = [this.application.ninja.currentDocument.documentRoot]; + selectedElements = [this.application.ninja.currentDocument.model.documentRoot]; } this._mouseDownHitRec = null; @@ -225,7 +225,7 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, { var selectedElements = this.application.ninja.selectedElements; if(this.rotateStage) { - selectedElements = [this.application.ninja.currentDocument.documentRoot]; + selectedElements = [this.application.ninja.currentDocument.model.documentRoot]; } if(this._handleMode !== null) @@ -345,7 +345,7 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, { var selectedElements = this.application.ninja.selectedElements; if(this.rotateStage) { - selectedElements = [this.application.ninja.currentDocument.documentRoot]; + selectedElements = [this.application.ninja.currentDocument.model.documentRoot]; } var len = selectedElements.length; for(var i = 0; i < len; i++) { @@ -481,7 +481,7 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, { } else { - this.target = this.application.ninja.currentDocument.documentRoot; + this.target = this.application.ninja.currentDocument.model.documentRoot; //this._origin = drawUtils._selectionCtr.slice(0); //this._origin[0] += this.application.ninja.stage.userContentLeft; //this._origin[1] += this.application.ninja.stage.userContentTop; @@ -609,7 +609,7 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, { if(this.rotateStage || (this.application.ninja.selectedElements.length === 1)) { if(this.rotateStage) { - element = this.application.ninja.currentDocument.documentRoot; + element = this.application.ninja.currentDocument.model.documentRoot; } else { element = this.application.ninja.selectedElements[0]; } @@ -851,7 +851,7 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, { else { lMode = false; - viewUtils.pushViewportObj( this.application.ninja.currentDocument.documentRoot ); + viewUtils.pushViewportObj( this.application.ninja.currentDocument.model.documentRoot ); } var base = this._origin; //console.log( "Rotate3DToolBase.DrawHandles, base: " + base ); diff --git a/js/tools/RotateStage3DTool.js b/js/tools/RotateStage3DTool.js index c8818021..92ed40d2 100755 --- a/js/tools/RotateStage3DTool.js +++ b/js/tools/RotateStage3DTool.js @@ -90,7 +90,7 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { this._origin = null; this._startOriginArray = null; - var stage = this.application.ninja.currentDocument.documentRoot; + var stage = this.application.ninja.currentDocument.model.documentRoot; this.target = stage; viewUtils.pushViewportObj( stage ); @@ -119,7 +119,7 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { captureElementChange: { value: function(event) { - if(event._event.item === this.application.ninja.currentDocument.documentRoot) + if(event._event.item === this.application.ninja.currentDocument.model.documentRoot) { this.captureSelectionDrawn(null); } @@ -132,9 +132,9 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { // Reset stage to identity matrix var iMat = Matrix.I(4); - ElementsMediator.setMatrix(this.application.ninja.currentDocument.documentRoot, + ElementsMediator.setMatrix(this.application.ninja.currentDocument.model.documentRoot, iMat, false, "rotateStage3DTool"); - this.application.ninja.currentDocument.documentRoot.elementModel.props3D.m_transformCtr = null; + this.application.ninja.currentDocument.model.documentRoot.elementModel.props3D.m_transformCtr = null; // let the document and stage manager know about the zoom change this.application.ninja.stage._firstDraw = true; diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js index 5c8b15ae..4bafa12a 100755 --- a/js/tools/SelectionTool.js +++ b/js/tools/SelectionTool.js @@ -165,7 +165,7 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { box[3] = point.y; //selectionManagerModule.selectionManager.marqueeSelection(box); - var childNodes = this.application.ninja.currentDocument.documentRoot.childNodes, + var childNodes = this.application.ninja.currentDocument.model.documentRoot.childNodes, selectionController = this.application.ninja.selectionController; childNodes = Array.prototype.slice.call(childNodes, 0); childNodes.forEach(function(item) { @@ -224,7 +224,7 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { if(this.application.ninja.selectedElements.length > 0) { this.application.ninja.currentSelectedContainer = this.application.ninja.selectedElements[0]; } else { - this.application.ninja.currentSelectedContainer = this.application.ninja.currentDocument.documentRoot; + this.application.ninja.currentSelectedContainer = this.application.ninja.currentDocument.model.documentRoot; } } }, @@ -690,7 +690,7 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { this.application.ninja.stage.clearDrawingCanvas(); var item = this._target; - if(!item || (item === this.application.ninja.currentDocument.documentRoot)) + if(!item || (item === this.application.ninja.currentDocument.model.documentRoot)) { return; } diff --git a/js/tools/Translate3DToolBase.js b/js/tools/Translate3DToolBase.js index f81ce6d6..8437ec09 100755 --- a/js/tools/Translate3DToolBase.js +++ b/js/tools/Translate3DToolBase.js @@ -296,7 +296,7 @@ exports.Translate3DToolBase = Montage.create(ModifierToolBase, //this._setTransformOrigin(false); } else { - this.target = this.application.ninja.currentDocument.documentRoot; + this.target = this.application.ninja.currentDocument.model.documentRoot; //this._origin = drawUtils._selectionCtr.slice(0); //this._origin[0] += this.application.ninja.stage.userContentLeft; //this._origin[1] += this.application.ninja.stage.userContentTop; @@ -407,7 +407,7 @@ exports.Translate3DToolBase = Montage.create(ModifierToolBase, else { lMode = false; - viewUtils.pushViewportObj( this.application.ninja.currentDocument.documentRoot ); + viewUtils.pushViewportObj( this.application.ninja.currentDocument.model.documentRoot ); } if(this._handleMode !== null) diff --git a/js/tools/ZoomTool.js b/js/tools/ZoomTool.js index 17301262..dc096592 100755 --- a/js/tools/ZoomTool.js +++ b/js/tools/ZoomTool.js @@ -184,7 +184,7 @@ exports.ZoomTool = Montage.create(DrawingTool, { _setZoom:{ value:function(mode,zoomFactor) { - var userContent = this.application.ninja.currentDocument.documentRoot; + var userContent = this.application.ninja.currentDocument.model.documentRoot; this._oldValue = this.application.ninja.documentBar.zoomFactor; var globalPt; diff --git a/js/tools/drawing-tool-base.js b/js/tools/drawing-tool-base.js index 0a3767b5..3549de1c 100755 --- a/js/tools/drawing-tool-base.js +++ b/js/tools/drawing-tool-base.js @@ -154,8 +154,8 @@ exports.DrawingToolBase = Montage.create(Component, { // get the hit rec. points in plane space var psPos = hitRec.getLocalPoint(); - var stageOffset = viewUtils.getElementOffset(this.application.ninja.currentDocument.documentRoot); - viewUtils.setViewportObj(this.application.ninja.currentDocument.documentRoot); + var stageOffset = viewUtils.getElementOffset(this.application.ninja.currentDocument.model.documentRoot); + viewUtils.setViewportObj(this.application.ninja.currentDocument.model.documentRoot); // get the matrix taking the local hit point in plane space // to world space of whatever element it is in. @@ -183,8 +183,8 @@ exports.DrawingToolBase = Montage.create(Component, { var p0 = hitRec0.getLocalPoint(), p1 = hitRec1.getLocalPoint(); - var stageOffset = viewUtils.getElementOffset(this.application.ninja.currentDocument.documentRoot); - viewUtils.setViewportObj(this.application.ninja.currentDocument.documentRoot); + var stageOffset = viewUtils.getElementOffset(this.application.ninja.currentDocument.model.documentRoot); + viewUtils.setViewportObj(this.application.ninja.currentDocument.model.documentRoot); // get the matrix taking the local hit point in plane space // to world space of whatever element it is in. @@ -308,10 +308,10 @@ exports.DrawingToolBase = Montage.create(Component, { var p0 = hitRec0.getLocalPoint(), p1 = hitRec1.getLocalPoint(); - var stageMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.documentRoot); + var stageMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.model.documentRoot); var elt = hitRec0.getElt(); if (!elt) { elt = hitRec1.getElt(); } - if (!elt) { elt = this.application.ninja.currentDocument.documentRoot; } + if (!elt) { elt = this.application.ninja.currentDocument.model.documentRoot; } if (elt) { viewUtils.pushViewportObj(elt); diff --git a/js/tools/modifier-tool-base.js b/js/tools/modifier-tool-base.js index d023206a..6aea77aa 100755 --- a/js/tools/modifier-tool-base.js +++ b/js/tools/modifier-tool-base.js @@ -39,7 +39,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { return this._clickedObject; }, set: function (value) { - if(value === this.application.ninja.currentDocument.documentRoot) + if(value === this.application.ninja.currentDocument.model.documentRoot) { this._clickedObject = this._target; } @@ -64,7 +64,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { value: function(hitRec) { var elt = hitRec.getElt(); - if(elt === this.application.ninja.currentDocument.documentRoot) + if(elt === this.application.ninja.currentDocument.model.documentRoot) { elt = this._target; } @@ -531,7 +531,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { snapManager.enableSnapAlign( snapManager.snapAlignEnabledAppLevel() ); if ( snapManager.snapAlignEnabled() && this._clickedObject && - (this._clickedObject !== this.application.ninja.currentDocument.documentRoot) ) + (this._clickedObject !== this.application.ninja.currentDocument.model.documentRoot) ) { var alignBounds = !hitRec || (hitRec.getType() == hitRec.SNAP_TYPE_STAGE) || hitRec.isSomeGridTypeSnap(); if (alignBounds) @@ -776,7 +776,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { } else { - this.target = this.application.ninja.currentDocument.documentRoot; + this.target = this.application.ninja.currentDocument.model.documentRoot; } // this._updateTargets(); } -- cgit v1.2.3