aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-28 13:19:52 -0800
committerValerio Virgillito2012-02-28 13:19:52 -0800
commit2ab07cb8ac76a06606ce455bb2e6b4889e3ddc65 (patch)
treeaed095ad5f21f7cec5dbb779afda5c05ff5cb7c5 /js/tools
parente5b1102f0cff7f5ba7074840ccf29dc1c02ced8e (diff)
parent347fc28227d822e9fea3fa823fae79cf14ea041c (diff)
downloadninja-2ab07cb8ac76a06606ce455bb2e6b4889e3ddc65.tar.gz
Merge branch 'integration' of https://github.com/ericmueller/ninja-internal into integration-candidate
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/LineTool.js5
-rwxr-xr-xjs/tools/PanTool.js23
2 files changed, 27 insertions, 1 deletions
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js
index 233316a5..0a7c0534 100755
--- a/js/tools/LineTool.js
+++ b/js/tools/LineTool.js
@@ -42,7 +42,10 @@ exports.LineTool = Montage.create(ShapeTool, {
42 } 42 }
43 43
44 this._strokeSize = ShapesController.GetValueInPixels(this.options.strokeSize.value, this.options.strokeSize.units, null); 44 this._strokeSize = ShapesController.GetValueInPixels(this.options.strokeSize.value, this.options.strokeSize.units, null);
45 this._strokeColor = this.application.ninja.colorController.colorToolbar.stroke.color.css; 45 if (this.application.ninja.colorController.colorToolbar.stroke.color)
46 this._strokeColor = this.application.ninja.colorController.colorToolbar.stroke.color.css;
47 else
48 this._strokeColor = [0,0,0,1];
46 this.startDraw(event); 49 this.startDraw(event);
47 } 50 }
48 }, 51 },
diff --git a/js/tools/PanTool.js b/js/tools/PanTool.js
index 71301d46..0537a27b 100755
--- a/js/tools/PanTool.js
+++ b/js/tools/PanTool.js
@@ -81,6 +81,14 @@ exports.PanTool = Montage.create(toolBase,
81 { 81 {
82 this._altKeyDown = true; 82 this._altKeyDown = true;
83 } 83 }
84 else if (event.shiftKey)
85 {
86 if (!this._shiftKeyDown)
87 {
88 this._shiftKeyDown = true;
89 this._shiftPt = this._lastGPt.slice();
90 }
91 }
84 } 92 }
85 }, 93 },
86 94
@@ -90,6 +98,10 @@ exports.PanTool = Montage.create(toolBase,
90 { 98 {
91 this._altKeyDown = false; 99 this._altKeyDown = false;
92 } 100 }
101 else if (event.keyCode === Keyboard.SHIFT)
102 {
103 this._shiftKeyDown = false;
104 }
93 } 105 }
94 }, 106 },
95 107
@@ -221,6 +233,7 @@ exports.PanTool = Montage.create(toolBase,
221 var tmpLocal = MathUtils.transformAndDivideHomogeneousPoint( this._globalPt, globalToLocalMat ); 233 var tmpLocal = MathUtils.transformAndDivideHomogeneousPoint( this._globalPt, globalToLocalMat );
222 234
223 this._lastGPt = this._globalPt.slice(); 235 this._lastGPt = this._globalPt.slice();
236 this._shiftPt = this._lastGPt.slice();
224 this._lastY = this._lastGPt[1]; 237 this._lastY = this._lastGPt[1];
225 238
226 // set up the matrices we will be needing 239 // set up the matrices we will be needing
@@ -285,6 +298,16 @@ exports.PanTool = Montage.create(toolBase,
285 this._globalPt[2] += dy; 298 this._globalPt[2] += dy;
286 gPt = [this._lastGPt[0], this._lastGPt[1], this._globalPt[2]]; 299 gPt = [this._lastGPt[0], this._lastGPt[1], this._globalPt[2]];
287 } 300 }
301 else if (this._shiftKeyDown)
302 {
303 var dx = Math.abs( this._shiftPt[0] - gPt[0] ),
304 dy = Math.abs( this._shiftPt[1] - gPt[1] );
305
306 if (dx >= dy)
307 gPt[1] = this._shiftPt[1];
308 else
309 gPt[0] = this._shiftPt[0];
310 }
288 311
289 // update the scrollbars 312 // update the scrollbars
290 var deltaGPt = VecUtils.vecSubtract(2, gPt, this._lastGPt); 313 var deltaGPt = VecUtils.vecSubtract(2, gPt, this._lastGPt);