aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-24 11:59:17 -0700
committerValerio Virgillito2012-05-24 11:59:17 -0700
commit70ff8dd670bc37c14caf850e06791d1e293b1e4b (patch)
tree8e00a27c6c908dda3e816d1f5aaf0d2a889ca5dc /js/tools
parenta8eb5c65a21af3bf8d8b8eb3e65b494b8bd9bc01 (diff)
parenta6db492176a85546047dae6d5ecb9cfc4325e043 (diff)
downloadninja-70ff8dd670bc37c14caf850e06791d1e293b1e4b.tar.gz
Merge pull request #255 from joseeight/Document
Cleaning up referencing to documentRoot
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/PanTool.js16
-rwxr-xr-xjs/tools/Rotate3DToolBase.js12
-rwxr-xr-xjs/tools/RotateStage3DTool.js8
-rwxr-xr-xjs/tools/SelectionTool.js6
-rwxr-xr-xjs/tools/Translate3DToolBase.js4
-rwxr-xr-xjs/tools/ZoomTool.js2
-rwxr-xr-xjs/tools/drawing-tool-base.js12
-rwxr-xr-xjs/tools/modifier-tool-base.js8
8 files changed, 34 insertions, 34 deletions
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,
47 HandleLeftButtonDown: { 47 HandleLeftButtonDown: {
48 value : function ( event ) { 48 value : function ( event ) {
49 // Determine the maximum horizontal and vertical scroll values 49 // Determine the maximum horizontal and vertical scroll values
50 this._maxHorizontalScroll = this.application.ninja.currentDocument.documentRoot.scrollWidth - this.application.ninja.stage._canvas.width - 11; 50 this._maxHorizontalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollWidth - this.application.ninja.stage._canvas.width - 11;
51 this._maxVerticalScroll = this.application.ninja.currentDocument.documentRoot.scrollHeight - this.application.ninja.stage._canvas.height - 11; 51 this._maxVerticalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollHeight - this.application.ninja.stage._canvas.height - 11;
52 if((this._maxHorizontalScroll > 0) || (this._maxVerticalScroll > 0) || this._altKeyDown) 52 if((this._maxHorizontalScroll > 0) || (this._maxVerticalScroll > 0) || this._altKeyDown)
53 { 53 {
54 this._isDrawing = true; 54 this._isDrawing = true;
@@ -121,7 +121,7 @@ exports.PanTool = Montage.create(toolBase,
121 { 121 {
122 value: function () 122 value: function ()
123 { 123 {
124 var uc = this.application.ninja.currentDocument.documentRoot; 124 var uc = this.application.ninja.currentDocument.model.documentRoot;
125 //var uc = documentManagerModule.DocumentManager.activeDocument 125 //var uc = documentManagerModule.DocumentManager.activeDocument
126 var ucMat = viewUtils.getMatrixFromElement(uc); 126 var ucMat = viewUtils.getMatrixFromElement(uc);
127 127
@@ -152,7 +152,7 @@ exports.PanTool = Montage.create(toolBase,
152 152
153 delta *= zoom; 153 delta *= zoom;
154 154
155 var uc = this.application.ninja.currentDocument.documentRoot; 155 var uc = this.application.ninja.currentDocument.model.documentRoot;
156 var ucMat = viewUtils.getMatrixFromElement(uc); 156 var ucMat = viewUtils.getMatrixFromElement(uc);
157 var offset = viewUtils.getElementOffset( uc ); 157 var offset = viewUtils.getElementOffset( uc );
158 //console.log( "uc offset: " + offset[0] ); 158 //console.log( "uc offset: " + offset[0] );
@@ -224,7 +224,7 @@ exports.PanTool = Montage.create(toolBase,
224 if (elt) 224 if (elt)
225 { 225 {
226 // get the userContent object (stage) and its matrix 226 // get the userContent object (stage) and its matrix
227 var userContent = this.application.ninja.currentDocument.documentRoot; 227 var userContent = this.application.ninja.currentDocument.model.documentRoot;
228 var ucMat = viewUtils.getMatrixFromElement(userContent); 228 var ucMat = viewUtils.getMatrixFromElement(userContent);
229 229
230 var localToGlobalMat = viewUtils.getLocalToGlobalMatrix( elt ); 230 var localToGlobalMat = viewUtils.getLocalToGlobalMatrix( elt );
@@ -358,7 +358,7 @@ exports.PanTool = Montage.create(toolBase,
358 delta[2] = 0; 358 delta[2] = 0;
359 359
360 // limit the change 360 // limit the change
361 var ucMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.documentRoot); 361 var ucMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.model.documentRoot);
362 var tooMuch = false; 362 var tooMuch = false;
363 if ((ucMat[12] > 12000) && (delta[0] > 0)) tooMuch = true; 363 if ((ucMat[12] > 12000) && (delta[0] > 0)) tooMuch = true;
364 if ((ucMat[12] < -12000) && (delta[0] < 0)) tooMuch = true; 364 if ((ucMat[12] < -12000) && (delta[0] < 0)) tooMuch = true;
@@ -397,7 +397,7 @@ exports.PanTool = Montage.create(toolBase,
397 value: function( transMat ) 397 value: function( transMat )
398 { 398 {
399 // update the user content matrix 399 // update the user content matrix
400 var uc = this.application.ninja.currentDocument.documentRoot; 400 var uc = this.application.ninja.currentDocument.model.documentRoot;
401 var ucMat = viewUtils.getMatrixFromElement(uc); 401 var ucMat = viewUtils.getMatrixFromElement(uc);
402 var newUCMat = glmat4.multiply( transMat, ucMat, [] ); 402 var newUCMat = glmat4.multiply( transMat, ucMat, [] );
403 viewUtils.setMatrixForElement( uc, newUCMat ); 403 viewUtils.setMatrixForElement( uc, newUCMat );
@@ -412,7 +412,7 @@ exports.PanTool = Montage.create(toolBase,
412 value: function() 412 value: function()
413 { 413 {
414 // get the userContent object 414 // get the userContent object
415 var userContent = this.application.ninja.currentDocument.documentRoot; 415 var userContent = this.application.ninja.currentDocument.model.documentRoot;
416 416
417 // get a matrix from user content world space to the screen 417 // get a matrix from user content world space to the screen
418 viewUtils.pushViewportObj( userContent ); 418 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, {
32 32
33 var selectedElements = this.application.ninja.selectedElements; 33 var selectedElements = this.application.ninja.selectedElements;
34 if(this.rotateStage) { 34 if(this.rotateStage) {
35 selectedElements = [this.application.ninja.currentDocument.documentRoot]; 35 selectedElements = [this.application.ninja.currentDocument.model.documentRoot];
36 } 36 }
37 37
38 this._mouseDownHitRec = null; 38 this._mouseDownHitRec = null;
@@ -225,7 +225,7 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, {
225 225
226 var selectedElements = this.application.ninja.selectedElements; 226 var selectedElements = this.application.ninja.selectedElements;
227 if(this.rotateStage) { 227 if(this.rotateStage) {
228 selectedElements = [this.application.ninja.currentDocument.documentRoot]; 228 selectedElements = [this.application.ninja.currentDocument.model.documentRoot];
229 } 229 }
230 230
231 if(this._handleMode !== null) 231 if(this._handleMode !== null)
@@ -345,7 +345,7 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, {
345 var selectedElements = this.application.ninja.selectedElements; 345 var selectedElements = this.application.ninja.selectedElements;
346 346
347 if(this.rotateStage) { 347 if(this.rotateStage) {
348 selectedElements = [this.application.ninja.currentDocument.documentRoot]; 348 selectedElements = [this.application.ninja.currentDocument.model.documentRoot];
349 } 349 }
350 var len = selectedElements.length; 350 var len = selectedElements.length;
351 for(var i = 0; i < len; i++) { 351 for(var i = 0; i < len; i++) {
@@ -481,7 +481,7 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, {
481 } 481 }
482 else 482 else
483 { 483 {
484 this.target = this.application.ninja.currentDocument.documentRoot; 484 this.target = this.application.ninja.currentDocument.model.documentRoot;
485 //this._origin = drawUtils._selectionCtr.slice(0); 485 //this._origin = drawUtils._selectionCtr.slice(0);
486 //this._origin[0] += this.application.ninja.stage.userContentLeft; 486 //this._origin[0] += this.application.ninja.stage.userContentLeft;
487 //this._origin[1] += this.application.ninja.stage.userContentTop; 487 //this._origin[1] += this.application.ninja.stage.userContentTop;
@@ -609,7 +609,7 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, {
609 609
610 if(this.rotateStage || (this.application.ninja.selectedElements.length === 1)) { 610 if(this.rotateStage || (this.application.ninja.selectedElements.length === 1)) {
611 if(this.rotateStage) { 611 if(this.rotateStage) {
612 element = this.application.ninja.currentDocument.documentRoot; 612 element = this.application.ninja.currentDocument.model.documentRoot;
613 } else { 613 } else {
614 element = this.application.ninja.selectedElements[0]; 614 element = this.application.ninja.selectedElements[0];
615 } 615 }
@@ -851,7 +851,7 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, {
851 else 851 else
852 { 852 {
853 lMode = false; 853 lMode = false;
854 viewUtils.pushViewportObj( this.application.ninja.currentDocument.documentRoot ); 854 viewUtils.pushViewportObj( this.application.ninja.currentDocument.model.documentRoot );
855 } 855 }
856 var base = this._origin; 856 var base = this._origin;
857 //console.log( "Rotate3DToolBase.DrawHandles, base: " + base ); 857 //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, {
90 this._origin = null; 90 this._origin = null;
91 this._startOriginArray = null; 91 this._startOriginArray = null;
92 92
93 var stage = this.application.ninja.currentDocument.documentRoot; 93 var stage = this.application.ninja.currentDocument.model.documentRoot;
94 this.target = stage; 94 this.target = stage;
95 95
96 viewUtils.pushViewportObj( stage ); 96 viewUtils.pushViewportObj( stage );
@@ -119,7 +119,7 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, {
119 119
120 captureElementChange: { 120 captureElementChange: {
121 value: function(event) { 121 value: function(event) {
122 if(event._event.item === this.application.ninja.currentDocument.documentRoot) 122 if(event._event.item === this.application.ninja.currentDocument.model.documentRoot)
123 { 123 {
124 this.captureSelectionDrawn(null); 124 this.captureSelectionDrawn(null);
125 } 125 }
@@ -132,9 +132,9 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, {
132 // Reset stage to identity matrix 132 // Reset stage to identity matrix
133 var iMat = Matrix.I(4); 133 var iMat = Matrix.I(4);
134 134
135 ElementsMediator.setMatrix(this.application.ninja.currentDocument.documentRoot, 135 ElementsMediator.setMatrix(this.application.ninja.currentDocument.model.documentRoot,
136 iMat, false, "rotateStage3DTool"); 136 iMat, false, "rotateStage3DTool");
137 this.application.ninja.currentDocument.documentRoot.elementModel.props3D.m_transformCtr = null; 137 this.application.ninja.currentDocument.model.documentRoot.elementModel.props3D.m_transformCtr = null;
138 138
139 // let the document and stage manager know about the zoom change 139 // let the document and stage manager know about the zoom change
140 this.application.ninja.stage._firstDraw = true; 140 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, {
165 box[3] = point.y; 165 box[3] = point.y;
166 166
167 //selectionManagerModule.selectionManager.marqueeSelection(box); 167 //selectionManagerModule.selectionManager.marqueeSelection(box);
168 var childNodes = this.application.ninja.currentDocument.documentRoot.childNodes, 168 var childNodes = this.application.ninja.currentDocument.model.documentRoot.childNodes,
169 selectionController = this.application.ninja.selectionController; 169 selectionController = this.application.ninja.selectionController;
170 childNodes = Array.prototype.slice.call(childNodes, 0); 170 childNodes = Array.prototype.slice.call(childNodes, 0);
171 childNodes.forEach(function(item) { 171 childNodes.forEach(function(item) {
@@ -224,7 +224,7 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
224 if(this.application.ninja.selectedElements.length > 0) { 224 if(this.application.ninja.selectedElements