aboutsummaryrefslogtreecommitdiff
path: root/js/stage
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/stage
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/stage')
-rwxr-xr-xjs/stage/layout.js6
-rwxr-xr-xjs/stage/stage.reel/stage.js28
-rwxr-xr-xjs/stage/tool-handle.js4
3 files changed, 19 insertions, 19 deletions
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, {
62 value: function() { 62 value: function() {
63 // Initial elements to draw are the childrens of the root element 63 // Initial elements to draw are the childrens of the root element
64 if(this.application.ninja.documentController.activeDocument.currentView === "design") { 64 if(this.application.ninja.documentController.activeDocument.currentView === "design") {
65 this.elementsToDraw = this.application.ninja.documentController.activeDocument.documentRoot.childNodes; 65 this.elementsToDraw = this.application.ninja.documentController.activeDocument.model.documentRoot.childNodes;
66 } 66 }
67 67
68 // Draw the elements and the 3d info 68 // Draw the elements and the 3d info
@@ -241,7 +241,7 @@ exports.Layout = Montage.create(Component, {
241 value: function() { 241 value: function() {
242 if(this.application.ninja.currentDocument) { 242 if(this.application.ninja.currentDocument) {
243 this.clearCanvas(); 243 this.clearCanvas();
244 this.WalkDOM(this.application.ninja.currentDocument.documentRoot); 244 this.WalkDOM(this.application.ninja.currentDocument.model.documentRoot);
245 245
246 //drawUtils.updatePlanes(); 246 //drawUtils.updatePlanes();
247 //if(this.application.ninja.currentDocument.draw3DGrid) drawUtils.drawWorkingPlane(); 247 //if(this.application.ninja.currentDocument.draw3DGrid) drawUtils.drawWorkingPlane();
@@ -253,7 +253,7 @@ exports.Layout = Montage.create(Component, {
253 drawElementsOutline: { 253 drawElementsOutline: {
254 value: function(elements) { 254 value: function(elements) {
255 this.clearCanvas(); 255 this.clearCanvas();
256 this.WalkDOM(this.application.ninja.currentDocument.documentRoot, elements); 256 this.WalkDOM(this.application.ninja.currentDocument.model.documentRoot, elements);
257 } 257 }
258 }, 258 },
259 259
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, {
189 set: function(value) { 189 set: function(value) {
190 this._userPaddingLeft = value; 190 this._userPaddingLeft = value;
191 this._documentOffsetLeft = -value; 191 this._documentOffsetLeft = -value;
192 this.application.ninja.currentDocument.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-left"] = -value + "px"; 192 this.application.ninja.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-left"] = -value + "px";
193 this.userContentLeft = this._documentOffsetLeft; 193 this.userContentLeft = this._documentOffsetLeft;
194 this.updatedStage = true; 194 this.updatedStage = true;
195 } 195 }
@@ -200,7 +200,7 @@ exports.Stage = Montage.create(Component, {
200 set: function(value) { 200 set: function(value) {
201 this._userPaddingTop = value; 201 this._userPaddingTop = value;
202 this._documentOffsetTop = -value; 202 this._documentOffsetTop = -value;
203 this.application.ninja.currentDocument.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-top"] = -value + "px"; 203 this.application.ninja.currentDocument.model.documentRoot.ownerDocument.getElementsByTagName("HTML")[0].style["padding-top"] = -value + "px";
204 this.userContentTop = this._documentOffsetTop; 204 this.userContentTop = this._documentOffsetTop;
205 this.updatedStage = true; 205 this.updatedStage = true;
206 } 206 }
@@ -283,8 +283,8 @@ exports.Stage = Montage.create(Component, {
283 this._userContentLeft = this._documentOffsetLeft; 283 this._userContentLeft = this._documentOffsetLeft;
284 this._userContentTop = this._documentOffsetTop; 284 this._userContentTop = this._documentOffsetTop;
285 285
286 this._maxHorizontalScroll = this.application.ninja.currentDocument.documentRoot.scrollWidth - this._canvas.width - 11; 286 this._maxHorizontalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollWidth - this._canvas.width - 11;
287 this._maxVerticalScroll = this.application.ninja.currentDocument.documentRoot.scrollHeight - this._canvas.height - 11; 287 this._maxVerticalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollHeight - this._canvas.height - 11;
288 this.application.ninja.currentDocument.model.views.design.iframe.contentWindow.addEventListener("scroll", this, false); 288 this.application.ninja.currentDocument.model.views.design.iframe.contentWindow.addEventListener("scroll", this, false);
289 289
290 // TODO - We will need to modify this once we support switching between multiple documents 290 // TODO - We will need to modify this once we support switching between multiple documents
@@ -478,8 +478,8 @@ exports.Stage = Montage.create(Component, {
478 // TODO - scroll events are not dependable. We may need to use a timer to simulate 478 // TODO - scroll events are not dependable. We may need to use a timer to simulate
479 // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values 479 // scrollBegin and scrollEnd. For now, the Pan Tool will keep track of the stage's scroll values
480 // on mouse down. 480 // on mouse down.
481 // this._maxHorizontalScroll = this.application.ninja.currentDocument.documentRoot.scrollWidth - this._canvas.width - 11; 481 // this._maxHorizontalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollWidth - this._canvas.width - 11;
482 // this._maxVerticalScroll = this.application.ninja.currentDocument.documentRoot.scrollHeight - this._canvas.height - 11; 482 // this._maxVerticalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollHeight - this._canvas.height - 11;
483 483
484 484
485 // Need to clear the snap cache and set up the drag plane 485 // Need to clear the snap cache and set up the drag plane
@@ -517,9 +517,9 @@ exports.Stage = Montage.create(Component, {
517 */ 517 */
518 centerStage: { 518 centerStage: {
519 value: function() { 519 value: function() {
520 if(this.application.ninja.currentDocument.documentRoot.id === "UserContent") { 520 if(this.application.ninja.currentDocument.model.documentRoot.id === "UserContent") {
521 this._iframeContainer.scrollLeft = this._documentOffsetLeft - (this._iframeContainer.offsetWidth - this.application.ninja.currentDocument.documentRoot.parentNode.offsetWidth)/2; 521 this._iframeContainer.scrollLeft = this._documentOffsetLeft - (this._iframeContainer.offsetWidth - this.application.ninja.currentDocument.model.documentRoot.parentNode.offsetWidth)/2;
522 this._iframeContainer.scrollTop = this._documentOffsetTop - (this._iframeContainer.offsetHeight - this.application.ninja.currentDocument.documentRoot.parentNode.offsetHeight)/2; 522 this._iframeContainer.scrollTop = this._documentOffsetTop - (this._iframeContainer.offsetHeight - this.application.ninja.currentDocument.model.documentRoot.parentNode.offsetHeight)/2;
523 523
524 this._scrollLeft = this._iframeContainer.scrollLeft; 524 this._scrollLeft = this._iframeContainer.scrollLeft;
525 this._scrollTop = this._iframeContainer.scrollTop; 525 this._scrollTop = this._iframeContainer.scrollTop;
@@ -889,7 +889,7 @@ exports.Stage = Montage.create(Component, {
889 889
890 setStageAsViewport: { 890 setStageAsViewport: {
891 value: function() { 891 value: function() {
892 this.stageDeps.viewUtils.setViewportObj(this.application.ninja.currentDocument.documentRoot); 892 this.stageDeps.viewUtils.setViewportObj(this.application.ninja.currentDocument.model.documentRoot);
893 } 893 }
894 }, 894 },
895 895
@@ -897,7 +897,7 @@ exports.Stage = Montage.create(Component, {
897 value: function(value) { 897 value: function(value) {
898 if(!this._firstDraw) 898 if(!this._firstDraw)
899 { 899 {
900 var userContent = this.application.ninja.currentDocument.documentRoot; 900 var userContent = this.application.ninja.currentDocument.model.documentRoot;
901 if (userContent) 901 if (userContent)
902 { 902 {
903 var w = this._canvas.width, 903 var w = this._canvas.width,
@@ -928,12 +928,12 @@ exports.Stage = Montage.create(Component, {
928 { 928 {
929 case "top": 929 case "top":
930 plane = [0,1,0,0]; 930 plane = [0,1,0,0];
931 plane[3] = this.application.ninja.currentDocument.documentRoot.offsetHeight / 2.0; 931 plane[3] = this.application.ninja.currentDocument.model.documentRoot.offsetHeight / 2.0;
932 break; 932 break;
933 933
934 case "side": 934 case "side":
935 plane = [1,0,0,0]; 935 plane = [1,0,0,0];
936 plane[3] = this.application.ninja.currentDocument.documentRoot.offsetWidth / 2.0; 936 plane[3] = this.application.ninja.currentDocument.model.documentRoot.offsetWidth / 2.0;
937 break; 937 break;
938 938
939 case "front": 939 case "front":
@@ -952,7 +952,7 @@ exports.Stage = Montage.create(Component, {
952 setStageView: { 952 setStageView: {
953 value: function(side) { 953 value: function(side) {
954 var mat, 954 var mat,
955 currentDoc = this.application.ninja.currentDocument.documentRoot, 955 currentDoc = this.application.ninja.currentDocument.model.documentRoot,
956 isDrawingGrid = this.application.ninja.appModel.show3dGrid; 956 isDrawingGrid = this.application.ninja.appModel.show3dGrid;
957 // Stage 3d Props. 957 // Stage 3d Props.
958 currentDoc.elementModel.props3D.ResetTranslationValues(); 958 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, {
243 this._origin = pointOnElt; 243 this._origin = pointOnElt;
244 244
245 245
246 var viewMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.documentRoot); 246 var viewMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.model.documentRoot);
247 247
248 var transMat = viewMat.slice(0); 248 var transMat = viewMat.slice(0);
249 if(inLocalMode) 249 if(inLocalMode)
@@ -585,7 +585,7 @@ exports.TranslateHandle = Montage.create(ToolHandle, {
585 this._origin = pointOnElt; 585 this._origin = pointOnElt;
586 586
587 587
588 var stage = this.application.ninja.currentDocument.documentRoot; 588 var stage = this.application.ninja.currentDocument.model.documentRoot;
589 var viewMat = viewUtils.getMatrixFromElement(stage); 589 var viewMat = viewUtils.getMatrixFromElement(stage);
590 // Get viewMat without zoom value 590 // Get viewMat without zoom value
591 var zoom = this.application.ninja.documentBar.zoomFactor/100; 591 var zoom = this.application.ninja.documentBar.zoomFactor/100;