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/stage/layout.js | 6 +++--- js/stage/stage.reel/stage.js | 28 ++++++++++++++-------------- js/stage/tool-handle.js | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'js/stage') diff --git a/js/stage/layout.js b/js/stage/layout.js index 9c5e2167..2ba39a87 100755 --- a/js/stage/layout.js +++ b/js/stage/layout.js @@ -62,7 +62,7 @@ exports.Layout = Montage.create(Component, { value: function() { // Initial elements to draw are the childrens of the root element if(this.application.ninja.documentController.activeDocument.currentView === "design") { - this.elementsToDraw = this.application.ninja.documentController.activeDocument.documentRoot.childNodes; + this.elementsToDraw = this.application.ninja.documentController.activeDocument.model.documentRoot.childNodes; } // Draw the elements and the 3d info @@ -241,7 +241,7 @@ exports.Layout = Montage.create(Component, { value: function() { if(this.application.ninja.currentDocument) { this.clearCanvas(); - this.WalkDOM(this.application.ninja.currentDocument.documentRoot); + this.WalkDOM(this.application.ninja.currentDocument.model.documentRoot); //drawUtils.updatePlanes(); //if(this.application.ninja.currentDocument.draw3DGrid) drawUtils.drawWorkingPlane(); @@ -253,7 +253,7 @@ exports.Layout = Montage.create(Component, { drawElementsOutline: { value: function(elements) { this.clearCanvas(); - this.WalkDOM(this.application.ninja.currentDocument.documentRoot, elements); + this.WalkDOM(this.application.ninja.currentDocument.model.documentRoot, elements); } }, diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index 69cfa7ba..f3c096d8 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js @@ -189,7 +189,7 @@ exports.Stage = Montage.create(Component, { set: function(value) { this._userPaddingLeft = value; this._documentOffsetLeft = -value; - this.application.ninja.currentDocument.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-left"] = -value + "px"; + this.application.ninja.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-left"] = -value + "px"; this.userContentLeft = this._documentOffsetLeft; this.updatedStage = true; } @@ -200,7 +200,7 @@ exports.Stage = Montage.create(Component, { set: function(value) { this._userPaddingTop = value; this._documentOffsetTop = -value; - this.application.ninja.currentDocument.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-top"] = -value + "px"; + this.application.ninja.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-top"] = -value + "px"; this.userContentTop = this._documentOffsetTop; this.updatedStage = true; } @@ -283,8 +283,8 @@ exports.Stage = Montage.create(Component, { this._userContentLeft = this._documentOffsetLeft; this._userContentTop = this._documentOffsetTop; - this._maxHorizontalScroll = this.application.ninja.currentDocument.documentRoot.scrollWidth - this._canvas.width - 11; - this._maxVerticalScroll = this.application.ninja.currentDocument.documentRoot.scrollHeight - this._canvas.height - 11; + this._maxHorizontalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollWidth - this._canvas.width - 11; + this._maxVerticalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollHeight - this._canvas.height - 11; this.application.ninja.currentDocument.model.views.design.iframe.contentWindow.addEventListener("scroll", this, false); // TODO - We will need to modify this once we support switching between multiple documents @@ -478,8 +478,8 @@ exports.Stage = Montage.create(Component, { // TODO - scroll events are not dependable. We may need to use a timer to simulate // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values // on mouse down. - // this._maxHorizontalScroll = this.application.ninja.currentDocument.documentRoot.scrollWidth - this._canvas.width - 11; - // this._maxVerticalScroll = this.application.ninja.currentDocument.documentRoot.scrollHeight - this._canvas.height - 11; + // this._maxHorizontalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollWidth - this._canvas.width - 11; + // this._maxVerticalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollHeight - this._canvas.height - 11; // Need to clear the snap cache and set up the drag plane @@ -517,9 +517,9 @@ exports.Stage = Montage.create(Component, { */ centerStage: { value: function() { - if(this.application.ninja.currentDocument.documentRoot.id === "UserContent") { - this._iframeContainer.scrollLeft = this._documentOffsetLeft - (this._iframeContainer.offsetWidth - this.application.ninja.currentDocument.documentRoot.parentNode.offsetWidth)/2; - this._iframeContainer.scrollTop = this._documentOffsetTop - (this._iframeContainer.offsetHeight - this.application.ninja.currentDocument.documentRoot.parentNode.offsetHeight)/2; + if(this.application.ninja.currentDocument.model.documentRoot.id === "UserContent") { + this._iframeContainer.scrollLeft = this._documentOffsetLeft - (this._iframeContainer.offsetWidth - this.application.ninja.currentDocument.model.documentRoot.parentNode.offsetWidth)/2; + this._iframeContainer.scrollTop = this._documentOffsetTop - (this._iframeContainer.offsetHeight - this.application.ninja.currentDocument.model.documentRoot.parentNode.offsetHeight)/2; this._scrollLeft = this._iframeContainer.scrollLeft; this._scrollTop = this._iframeContainer.scrollTop; @@ -889,7 +889,7 @@ exports.Stage = Montage.create(Component, { setStageAsViewport: { value: function() { - this.stageDeps.viewUtils.setViewportObj(this.application.ninja.currentDocument.documentRoot); + this.stageDeps.viewUtils.setViewportObj(this.application.ninja.currentDocument.model.documentRoot); } }, @@ -897,7 +897,7 @@ exports.Stage = Montage.create(Component, { value: function(value) { if(!this._firstDraw) { - var userContent = this.application.ninja.currentDocument.documentRoot; + var userContent = this.application.ninja.currentDocument.model.documentRoot; if (userContent) { var w = this._canvas.width, @@ -928,12 +928,12 @@ exports.Stage = Montage.create(Component, { { case "top": plane = [0,1,0,0]; - plane[3] = this.application.ninja.currentDocument.documentRoot.offsetHeight / 2.0; + plane[3] = this.application.ninja.currentDocument.model.documentRoot.offsetHeight / 2.0; break; case "side": plane = [1,0,0,0]; - plane[3] = this.application.ninja.currentDocument.documentRoot.offsetWidth / 2.0; + plane[3] = this.application.ninja.currentDocument.model.documentRoot.offsetWidth / 2.0; break; case "front": @@ -952,7 +952,7 @@ exports.Stage = Montage.create(Component, { setStageView: { value: function(side) { var mat, - currentDoc = this.application.ninja.currentDocument.documentRoot, + currentDoc = this.application.ninja.currentDocument.model.documentRoot, isDrawingGrid = this.application.ninja.appModel.show3dGrid; // Stage 3d Props. currentDoc.elementModel.props3D.ResetTranslationValues(); diff --git a/js/stage/tool-handle.js b/js/stage/tool-handle.js index 63cf30e5..70289512 100755 --- a/js/stage/tool-handle.js +++ b/js/stage/tool-handle.js @@ -243,7 +243,7 @@ exports.RotateHandle = Montage.create(ToolHandle, { this._origin = pointOnElt; - var viewMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.documentRoot); + var viewMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.model.documentRoot); var transMat = viewMat.slice(0); if(inLocalMode) @@ -585,7 +585,7 @@ exports.TranslateHandle = Montage.create(ToolHandle, { this._origin = pointOnElt; - var stage = this.application.ninja.currentDocument.documentRoot; + var stage = this.application.ninja.currentDocument.model.documentRoot; var viewMat = viewUtils.getMatrixFromElement(stage); // Get viewMat without zoom value var zoom = this.application.ninja.documentBar.zoomFactor/100; -- cgit v1.2.3