aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorKruti Shah2012-05-31 10:44:45 -0700
committerKruti Shah2012-05-31 10:44:45 -0700
commitc350cc1c060fdf17357ddadce024267943784593 (patch)
tree453f86e88f1ee1dfda6fb4b7cc7b17e306e39536 /js/tools
parentfdc4f5c7f81ae3b9adeca2232e60268b4be594a2 (diff)
parent121d0e616f48aa7cd048763554089c20a1883d7a (diff)
downloadninja-c350cc1c060fdf17357ddadce024267943784593.tar.gz
Merge branch 'refs/heads/TimelineUberjd' into TimelineUber
Conflicts: js/panels/Timeline/Layer.reel/Layer.js Signed-off-by: Kruti Shah <kruti.shah@motorola.com>
Diffstat (limited to 'js/tools')
-rw-r--r--js/tools/BrushTool.js2
-rwxr-xr-xjs/tools/FillTool.js7
-rwxr-xr-xjs/tools/InkBottleTool.js2
-rwxr-xr-xjs/tools/LineTool.js6
-rwxr-xr-xjs/tools/OvalTool.js4
-rwxr-xr-xjs/tools/PanTool.js77
-rwxr-xr-xjs/tools/PenTool.js6
-rwxr-xr-xjs/tools/PencilTool.js32
-rwxr-xr-xjs/tools/RectTool.js4
-rwxr-xr-xjs/tools/Rotate3DToolBase.js12
-rwxr-xr-xjs/tools/RotateStage3DTool.js40
-rwxr-xr-xjs/tools/SelectionTool.js9
-rwxr-xr-xjs/tools/ShapeTool.js2
-rwxr-xr-xjs/tools/TagTool.js5
-rwxr-xr-xjs/tools/Translate3DToolBase.js4
-rwxr-xr-xjs/tools/ZoomTool.js6
-rwxr-xr-xjs/tools/drawing-tool-base.js39
-rwxr-xr-xjs/tools/modifier-tool-base.js8
18 files changed, 120 insertions, 145 deletions
diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js
index 5c334b92..0be378fd 100644
--- a/js/tools/BrushTool.js
+++ b/js/tools/BrushTool.js
@@ -132,7 +132,7 @@ exports.BrushTool = Montage.create(ShapeTool, {
132 if (this._selectedBrushStroke === null){ 132 if (this._selectedBrushStroke === null){
133 this._selectedBrushStroke = new BrushStroke(); 133 this._selectedBrushStroke = new BrushStroke();
134 var colorArray=[0,0,0,0]; 134 var colorArray=[0,0,0,0];
135 var color = this.application.ninja.colorController.colorToolbar.fill.color; 135 var color = this.options.fill.color;
136 if (color){ 136 if (color){
137 colorArray = [color.r/255, color.g/255, color.b/255, color.a]; 137 colorArray = [color.r/255, color.g/255, color.b/255, color.a];
138 } else { 138 } else {
diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js
index 87a093ff..66dd9305 100755
--- a/js/tools/FillTool.js
+++ b/js/tools/FillTool.js
@@ -72,9 +72,9 @@ exports.FillTool = Montage.create(ModifierToolBase, {
72 value: function(event) { 72 value: function(event) {
73 this.isDrawing = true; 73 this.isDrawing = true;
74 74
75 if(this._canColor && this.application.ninja.selectedElements.length) 75 if(this._canColor && this.application.ninja.selectedElements.length) {
76 { 76
77 var color = this.application.ninja.colorController.colorToolbar.fill, 77 var color = this.options.fill,
78 colorInfo; 78 colorInfo;
79 if(color && color.color) 79 if(color && color.color)
80 { 80 {
@@ -92,5 +92,4 @@ exports.FillTool = Montage.create(ModifierToolBase, {
92 } 92 }
93 } 93 }
94 } 94 }
95
96}); \ No newline at end of file 95}); \ No newline at end of file
diff --git a/js/tools/InkBottleTool.js b/js/tools/InkBottleTool.js
index fd17f4d6..2c03d133 100755
--- a/js/tools/InkBottleTool.js
+++ b/js/tools/InkBottleTool.js
@@ -69,7 +69,7 @@ exports.InkBottleTool = Montage.create(ModifierToolBase, {
69 69
70 if(this._canColor && this.application.ninja.selectedElements.length) 70 if(this._canColor && this.application.ninja.selectedElements.length)
71 { 71 {
72 var color = this.application.ninja.colorController.colorToolbar.stroke, 72 var color = this.options.stroke,
73 colorInfo; 73 colorInfo;
74 if(color && color.color) 74 if(color && color.color)
75 { 75 {
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js
index 198d7e69..b2b48383 100755
--- a/js/tools/LineTool.js
+++ b/js/tools/LineTool.js
@@ -44,8 +44,8 @@ exports.LineTool = Montage.create(ShapeTool, {
44 } 44 }
45 45
46 this._strokeSize = ShapesController.GetValueInPixels(this.options.strokeSize.value, this.options.strokeSize.units, null); 46 this._strokeSize = ShapesController.GetValueInPixels(this.options.strokeSize.value, this.options.strokeSize.units, null);
47 if (this.application.ninja.colorController.colorToolbar.stroke.color) 47 if (this.options.stroke.color)
48 this._strokeColor = this.application.ninja.colorController.colorToolbar.stroke.color.css; 48 this._strokeColor = this.options.stroke.color.css;
49 else 49 else
50 this._strokeColor = [0,0,0,1]; 50 this._strokeColor = [0,0,0,1];
51 this.startDraw(event); 51 this.startDraw(event);
@@ -215,7 +215,7 @@ exports.LineTool = Montage.create(ShapeTool, {
215 var left = Math.round(midPt[0] - 0.5*w); 215 var left = Math.round(midPt[0] - 0.5*w);
216 var top = Math.round(midPt[1] - 0.5*h); 216 var top = Math.round(midPt[1] - 0.5*h);
217 217
218 var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor; 218 var strokeColor = this.options.stroke.webGlColor;
219 // for default stroke and fill/no materials 219 // for default stroke and fill/no materials
220 var strokeMaterial = null; 220 var strokeMaterial = null;
221 221
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js
index e9dc66bb..ce812398 100755
--- a/js/tools/OvalTool.js
+++ b/js/tools/OvalTool.js
@@ -39,8 +39,8 @@ exports.OvalTool = Montage.create(ShapeTool, {
39 39
40 var innerRadius = this.options.innerRadius.value / 100; 40 var innerRadius = this.options.innerRadius.value / 100;
41 41
42 var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor; 42 var strokeColor = this.options.stroke.webGlColor;
43 var fillColor = this.application.ninja.colorController.colorToolbar.fill.webGlColor; 43 var fillColor = this.options.fill.webGlColor;
44 44
45 // for default stroke and fill/no materials 45 // for default stroke and fill/no materials
46 var strokeMaterial = null; 46 var strokeMaterial = null;
diff --git a/js/tools/PanTool.js b/js/tools/PanTool.js
index ce7606a1..39f89d17 100755
--- a/js/tools/PanTool.js
+++ b/js/tools/PanTool.js
@@ -21,6 +21,9 @@ exports.PanTool = Montage.create(toolBase,
21 _lastGPt :{value: [0,0], writable:true}, 21 _lastGPt :{value: [0,0], writable:true},
22 _lastY :{value: 0, writable:true}, 22 _lastY :{value: 0, writable:true},
23 23
24 _maxHorizontalScroll: {value: 0, writable:true},
25 _maxVerticalScroll: {value: 0, writable:true},
26
24 Configure: { 27 Configure: {
25 value: function ( doActivate ) 28 value: function ( doActivate )
26 { 29 {
@@ -43,10 +46,19 @@ exports.PanTool = Montage.create(toolBase,
43 46
44 HandleLeftButtonDown: { 47 HandleLeftButtonDown: {
45 value : function ( event ) { 48 value : function ( event ) {
46 this._isDrawing = true; 49 // Determine the maximum horizontal and vertical scroll values
47 this.isDrawing = true; 50 this._maxHorizontalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollWidth - this.application.ninja.stage._canvas.width - 11;
48 51 this._maxVerticalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollHeight - this.application.ninja.stage._canvas.height - 11;
49 this.mouseDown( event ); 52 if((this._maxHorizontalScroll > 0) || (this._maxVerticalScroll > 0) || this._altKeyDown)
53 {
54 this._isDrawing = true;
55 this.isDrawing = true;
56 this.mouseDown( event );
57 }
58// else
59// {
60// console.log("nothing to scroll");
61// }
50 } 62 }
51 }, 63 },
52 64
@@ -109,7 +121,7 @@ exports.PanTool = Montage.create(toolBase,
109 { 121 {
110 value: function () 122 value: function ()
111 { 123 {
112 var uc = this.application.ninja.currentDocument.documentRoot; 124 var uc = this.application.ninja.currentDocument.model.documentRoot;
113 //var uc = documentManagerModule.DocumentManager.activeDocument 125 //var uc = documentManagerModule.DocumentManager.activeDocument
114 var ucMat = viewUtils.getMatrixFromElement(uc); 126 var ucMat = viewUtils.getMatrixFromElement(uc);
115 127
@@ -136,12 +148,11 @@ exports.PanTool = Montage.create(toolBase,
136 delta = 10*event.wheelDelta/120; 148 delta = 10*event.wheelDelta/120;
137 //console.log( "delta: " + delta ); 149 //console.log( "delta: " + delta );
138 150
139 this.application.ninja.stage._iframeContainer.scrollLeft += delta; 151 this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft += delta;
140 this.application.ninja.stage._scrollLeft += delta;
141 152
142 delta *= zoom; 153 delta *= zoom;
143 154
144 var uc = this.application.ninja.currentDocument.documentRoot; 155 var uc = this.application.ninja.currentDocument.model.documentRoot;
145 var ucMat = viewUtils.getMatrixFromElement(uc); 156 var ucMat = viewUtils.getMatrixFromElement(uc);
146 var offset = viewUtils.getElementOffset( uc ); 157 var offset = viewUtils.getElementOffset( uc );
147 //console.log( "uc offset: " + offset[0] ); 158 //console.log( "uc offset: " + offset[0] );
@@ -213,7 +224,7 @@ exports.PanTool = Montage.create(toolBase,
213 if (elt) 224 if (elt)
214 { 225 {
215 // get the userContent object (stage) and its matrix 226 // get the userContent object (stage) and its matrix
216 var userContent = this.application.ninja.currentDocument.documentRoot; 227 var userContent = this.application.ninja.currentDocument.model.documentRoot;
217 var ucMat = viewUtils.getMatrixFromElement(userContent); 228 var ucMat = viewUtils.getMatrixFromElement(userContent);
218 229
219 var localToGlobalMat = viewUtils.getLocalToGlobalMatrix( elt ); 230 var localToGlobalMat = viewUtils.getLocalToGlobalMatrix( elt );
@@ -291,17 +302,19 @@ exports.PanTool = Montage.create(toolBase,
291 if (this._isDrawing) 302 if (this._isDrawing)
292 { 303 {
293 // get the global screen point 304 // get the global screen point
294 var gPt = [point.x, point.y, this._globalPt[2]]; 305 var gPt = [point.x, point.y, this._globalPt[2]],
306 dx,
307 dy;
295 if (this._altKeyDown) 308 if (this._altKeyDown)
296 { 309 {
297 var dy = 5*(point.y - this._lastY); 310 dy = 5*(point.y - this._lastY);
298 this._globalPt[2] += dy; 311 this._globalPt[2] += dy;
299 gPt = [this._lastGPt[0], this._lastGPt[1], this._globalPt[2]]; 312 gPt = [this._lastGPt[0], this._lastGPt[1], this._globalPt[2]];
300 } 313 }
301 else if (this._shiftKeyDown) 314 else if (this._shiftKeyDown)
302 { 315 {
303 var dx = Math.abs( this._shiftPt[0] - gPt[0] ), 316 dx = Math.abs( this._shiftPt[0] - gPt[0] );
304 dy = Math.abs( this._shiftPt[1] - gPt[1] ); 317 dy = Math.abs( this._shiftPt[1] - gPt[1] );
305 318
306 if (dx >= dy) 319 if (dx >= dy)
307 gPt[1] = this._