aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-24 00:32:18 -0700
committerValerio Virgillito2012-07-24 00:32:18 -0700
commit2222e73faee8326e4d5be276bc8486316d83f2a6 (patch)
treef9aa990bd281da9543fd42231cfb76a2e1040243
parent3f7a5c3482ddb4e7a1b222df314dbc6baf59bb44 (diff)
parent55a69aeb3c66b533d5a2d27d7548471c2c8b5dfc (diff)
downloadninja-2222e73faee8326e4d5be276bc8486316d83f2a6.tar.gz
Merge branch 'jshint' of https://github.com/mencio/ninja into v0.7.1
-rwxr-xr-xjs/tools/EyedropperTool.js26
-rwxr-xr-xjs/tools/FillTool.js7
-rwxr-xr-xjs/tools/InkBottleTool.js7
-rwxr-xr-xjs/tools/PanTool.js22
-rwxr-xr-xjs/tools/PenTool.js28
-rwxr-xr-xjs/tools/Rotate3DToolBase.js7
-rwxr-xr-xjs/tools/SelectionTool.js103
-rwxr-xr-xjs/tools/ShapeTool.js12
-rwxr-xr-xjs/tools/TextTool.js6
-rwxr-xr-xjs/tools/TranslateObject3DTool.js11
-rwxr-xr-xjs/tools/ZoomTool.js330
-rwxr-xr-xjs/tools/drawing-tool-base.js7
-rwxr-xr-xjs/tools/modifier-tool-base.js8
13 files changed, 251 insertions, 323 deletions
diff --git a/js/tools/EyedropperTool.js b/js/tools/EyedropperTool.js
index 3d0799e0..1d97d11b 100755
--- a/js/tools/EyedropperTool.js
+++ b/js/tools/EyedropperTool.js
@@ -95,22 +95,19 @@ exports.EyedropperTool = Montage.create(toolBase, {
95 }, 95 },
96 96
97 HandleLeftButtonUp: { 97 HandleLeftButtonUp: {
98 value : function (event) { 98 value: function(event) {
99 { 99 this._isMouseDown = false;
100 this._isMouseDown = false;
101 100
102 if(this._escape) 101 if(this._escape) {
103 { 102 this._escape = false;
104 this._escape = false; 103 }
105 }
106 104
107 this._updateColor(this._color, true); 105 this._updateColor(this._color, true);
108 106
109 this._color = null; 107 this._color = null;
110 108
111 this._elementUnderMouse = null; 109 this._elementUnderMouse = null;
112 this._deleteImageDataCanvas(); 110 this._deleteImageDataCanvas();
113 }
114 } 111 }
115 }, 112 },
116 113
@@ -237,8 +234,7 @@ exports.EyedropperTool = Montage.create(toolBase, {
237 234
238 if(color.mode === "gradient") 235 if(color.mode === "gradient")
239 { 236 {
240 this.application.ninja.colorController.colorModel["gradient"] = 237 this.application.ninja.colorController.colorModel.gradient = {value: color.color, wasSetByCode: true, type: eventType};
241 {value: color.color, wasSetByCode: true, type: eventType};
242 } 238 }
243 else 239 else
244 { 240 {
@@ -253,7 +249,7 @@ exports.EyedropperTool = Montage.create(toolBase, {
253 } 249 }
254 else 250 else
255 { 251 {
256 this.application.ninja.colorController.colorModel["rgb"] = color.color; 252 this.application.ninja.colorController.colorModel.rgb = color.color;
257 } 253 }
258 } 254 }
259 255
diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js
index 16a6f464..2c783cb6 100755
--- a/js/tools/FillTool.js
+++ b/js/tools/FillTool.js
@@ -77,13 +77,12 @@ exports.FillTool = Montage.create(ModifierToolBase, {
77 }, 77 },
78 78
79 HandleLeftButtonUp: { 79 HandleLeftButtonUp: {
80 value : function () { 80 value: function() {
81 //if(this._isDrawing) 81 //if(this._isDrawing) {
82 {
83 this.application.ninja.stage.clearDrawingCanvas(); 82 this.application.ninja.stage.clearDrawingCanvas();
84 this._hasDraw = false; 83 this._hasDraw = false;
85 this._isDrawing = false; 84 this._isDrawing = false;
86 } 85 //}
87 } 86 }
88 }, 87 },
89 88
diff --git a/js/tools/InkBottleTool.js b/js/tools/InkBottleTool.js
index c4197e77..68e7d107 100755
--- a/js/tools/InkBottleTool.js
+++ b/js/tools/InkBottleTool.js
@@ -77,13 +77,12 @@ exports.InkBottleTool = Montage.create(ModifierToolBase, {
77 }, 77 },
78 78
79 HandleLeftButtonUp: { 79 HandleLeftButtonUp: {
80 value : function () { 80 value: function() {
81 //if(this._isDrawing) 81 //if(this._isDrawing) {
82 {
83 this.application.ninja.stage.clearDrawingCanvas(); 82 this.application.ninja.stage.clearDrawingCanvas();
84 this._hasDraw = false; 83 this._hasDraw = false;
85 this._isDrawing = false; 84 this._isDrawing = false;
86 } 85 //}
87 } 86 }
88 }, 87 },
89 88
diff --git a/js/tools/PanTool.js b/js/tools/PanTool.js
index 374886e8..cab25726 100755
--- a/js/tools/PanTool.js
+++ b/js/tools/PanTool.js
@@ -95,12 +95,9 @@ exports.PanTool = Montage.create(toolBase,
95 } 95 }
96 }, 96 },
97 97
98 HandleLeftButtonUp: 98 HandleLeftButtonUp: {
99 { 99 value: function(event) {
100 value : function ( event ) 100 //if(this._isDrawing) {
101 {
102 //if(this._isDrawing)
103 {
104 // do one final mouse move to update the scrollbars 101 // do one final mouse move to update the scrollbars
105 this.mouseUp( event ); 102 this.mouseUp( event );
106 103
@@ -108,7 +105,7 @@ exports.PanTool = Montage.create(toolBase,
108 this._hasDraw = false; 105 this._hasDraw = false;
109 this._isDrawing = false; 106 this._isDrawing = false;
110 this.isDrawing = false; 107 this.isDrawing = false;
111 } 108 //}
112 } 109 }
113 }, 110 },
114 111
@@ -234,11 +231,10 @@ exports.PanTool = Montage.create(toolBase,
234 }, 231 },
235 232
236 233
237 doMouseDown: 234 doMouseDown: {
238 { 235 value: function(point) {
239 value: function( point )
240 {
241 //var tmpPt, tmpPt2, tmpPt3, tmpPt4, tmpMat, tmpMat2; // DEBUG. (see use of these points below) 236 //var tmpPt, tmpPt2, tmpPt3, tmpPt4, tmpMat, tmpMat2; // DEBUG. (see use of these points below)
237 var cop;
242 var hitRec = snapManager.snap( point.x, point.y, true ); 238 var hitRec = snapManager.snap( point.x, point.y, true );
243 if (hitRec) 239 if (hitRec)
244 { 240 {
@@ -260,7 +256,7 @@ exports.PanTool = Montage.create(toolBase,
260 { 256 {
261 var localPt = hitRec.calculateElementWorldPoint(); 257 var localPt = hitRec.calculateElementWorldPoint();
262 viewUtils.pushViewportObj( userContent ); 258 viewUtils.pushViewportObj( userContent );
263 var cop = viewUtils.getCenterOfProjection(); 259 cop = viewUtils.getCenterOfProjection();
264 this._localPt = [cop[0] + localPt[0], cop[1] + localPt[1], localPt[2]]; 260 this._localPt = [cop[0] + localPt[0], cop[1] + localPt[1], localPt[2]];
265 viewUtils.popViewportObj(); 261 viewUtils.popViewportObj();
266 } 262 }
@@ -284,7 +280,7 @@ exports.PanTool = Montage.create(toolBase,
284 280
285 // get a matrix from user content world space to the screen 281 // get a matrix from user content world space to the screen
286 viewUtils.pushViewportObj( userContent ); 282 viewUtils.pushViewportObj( userContent );
287 var cop = viewUtils.getCenterOfProjection(); 283 cop = viewUtils.getCenterOfProjection();
288 var pDist = viewUtils.getPerspectiveDistFromElement(userContent); 284 var pDist = viewUtils.getPerspectiveDistFromElement(userContent);
289 var projMat = glmat4.scale(Matrix.I(4), [pDist,pDist,pDist], []); 285 var projMat = glmat4.scale(Matrix.I(4), [pDist,pDist,pDist], []);
290 projMat[11] = -1; 286 projMat[11] = -1;
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index 4b4fd227..a44438ac 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -302,6 +302,7 @@ exports.PenTool = Montage.create(ShapeTool, {
302 HandleLeftButtonDown: 302 HandleLeftButtonDown:
303 { 303 {
304 value: function (event) { 304 value: function (event) {
305 var newAnchor;
305 //ignore any right or middle clicks 306 //ignore any right or middle clicks
306 if (event.button !== 0) { 307 if (event.button !== 0) {
307 //todo NOTE: this will work on Webkit only...IE has different codes (left: 1, middle: 4, right: 2) 308 //todo NOTE: this will work on Webkit only...IE has different codes (left: 1, middle: 4, right: 2)
@@ -427,7 +428,7 @@ exports.PenTool = Montage.create(ShapeTool, {
427 428
428 } else { 429 } else {
429 this._selectedSubpath.addAnchor(new AnchorPoint()); 430 this._selectedSubpath.addAnchor(new AnchorPoint());
430 var newAnchor = this._selectedSubpath.getAnchor(this._selectedSubpath.getSelectedAnchorIndex()); 431 newAnchor = this._selectedSubpath.getAnchor(this._selectedSubpath.getSelectedAnchorIndex());
431 newAnchor.setPos(stageWorldMousePos[0], stageWorldMousePos[1], stageWorldMousePos[2]); 432 newAnchor.setPos(stageWorldMousePos[0], stageWorldMousePos[1], stageWorldMousePos[2]);
432 newAnchor.setPrevPos(stageWorldMousePos[0], stageWorldMousePos[1], stageWorldMousePos[2]); 433 newAnchor.setPrevPos(stageWorldMousePos[0], stageWorldMousePos[1], stageWorldMousePos[2]);
433 newAnchor.setNextPos(stageWorldMousePos[0], stageWorldMousePos[1], stageWorldMousePos[2]); 434 newAnchor.setNextPos(stageWorldMousePos[0], stageWorldMousePos[1], stageWorldMousePos[2]);
@@ -489,7 +490,7 @@ exports.PenTool = Montage.create(ShapeTool, {
489 if (numAnchors>1 && !this._selectedSubpath.getIsClosed() && this._selectedSubpath.getSelectedAnchorIndex()===0 && prevSelectedAnchorIndex === numAnchors-1){ 490 if (numAnchors>1 && !this._selectedSubpath.getIsClosed() && this._selectedSubpath.getSelectedAnchorIndex()===0 && prevSelectedAnchorIndex === numAnchors-1){
490 //insert an anchor temporarily that will get removed in the mouse up handler 491 //insert an anchor temporarily that will get removed in the mouse up handler
491 this._selectedSubpath.addAnchor(new AnchorPoint()); 492 this._selectedSubpath.addAnchor(new AnchorPoint());
492 var newAnchor = this._selectedSubpath.getAnchor(this._selectedSubpath.getSelectedAnchorIndex()); 493 newAnchor = this._selectedSubpath.getAnchor(this._selectedSubpath.getSelectedAnchorIndex());
493 newAnchor.setPos(localMousePos[0], localMousePos[1], localMousePos[2]); 494 newAnchor.setPos(localMousePos[0], localMousePos[1], localMousePos[2]);
494 newAnchor.setPrevPos(localMousePos[0], localMousePos[1], localMousePos[2]); 495 newAnchor.setPrevPos(localMousePos[0], localMousePos[1], localMousePos[2]);
495 newAnchor.setNextPos(localMousePos[0], localMousePos[1], localMousePos[2]); 496 newAnchor.setNextPos(localMousePos[0], localMousePos[1], localMousePos[2]);
@@ -534,7 +535,7 @@ exports.PenTool = Montage.create(ShapeTool, {
534 ) { 535 ) {
535 if (!this._selectedSubpath.getIsClosed()) { //todo this test is probably unnecessary, but doing it to be safe 536 if (!this._selectedSubpath.getIsClosed()) { //todo this test is probably unnecessary, but doing it to be safe
536 this._selectedSubpath.addAnchor(new AnchorPoint()); 537 this._selectedSubpath.addAnchor(new AnchorPoint());
537 var newAnchor = this._selectedSubpath.getAnchor(this._selectedSubpath.getSelectedAnchorIndex()); 538 newAnchor = this._selectedSubpath.getAnchor(this._selectedSubpath.getSelectedAnchorIndex());
538 539
539 newAnchor.setPos(localMousePos[0], localMousePos[1], localMousePos[2]); 540 newAnchor.setPos(localMousePos[0], localMousePos[1], localMousePos[2]);