diff options
author | Pushkar Joshi | 2012-02-02 11:28:45 -0800 |
---|---|---|
committer | Pushkar Joshi | 2012-02-02 11:28:45 -0800 |
commit | acc500d1f1c76f4e7c93ae1cfea8d925ca95e7b9 (patch) | |
tree | 877f8ca734228c11050b037ce82fc0d1e1303193 /js/tools/ZoomTool.js | |
parent | 4d4de64472603426a73b26cc98ba8206190949b8 (diff) | |
parent | 4222db97e353fb65fab787ba5927d16d9fa4e1f7 (diff) | |
download | ninja-acc500d1f1c76f4e7c93ae1cfea8d925ca95e7b9.tar.gz |
Merge branch 'working' of c:/Code/github/emueller/ninja-internal/ into pentool
Diffstat (limited to 'js/tools/ZoomTool.js')
-rw-r--r-- | js/tools/ZoomTool.js | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/js/tools/ZoomTool.js b/js/tools/ZoomTool.js index cabf3a3d..73297d16 100644 --- a/js/tools/ZoomTool.js +++ b/js/tools/ZoomTool.js | |||
@@ -74,10 +74,12 @@ exports.ZoomTool = Montage.create(DrawingTool, { | |||
74 | if(wasSelected) { | 74 | if(wasSelected) { |
75 | this.AddCustomFeedback(); | 75 | this.AddCustomFeedback(); |
76 | this.eventManager.addEventListener( "toolDoubleClick", this, false); | 76 | this.eventManager.addEventListener( "toolDoubleClick", this, false); |
77 | this.application.ninja.stage.drawingCanvas.addEventListener("mousewheel", this, false); | ||
77 | 78 | ||
78 | } else { | 79 | } else { |
79 | this.RemoveCustomFeedback(); | 80 | this.RemoveCustomFeedback(); |
80 | this.eventManager.removeEventListener( "toolDoubleClick", this, false); | 81 | this.eventManager.removeEventListener( "toolDoubleClick", this, false); |
82 | this.application.ninja.stage.drawingCanvas.removeEventListener("mousewheel", this, false); | ||
81 | } | 83 | } |
82 | } | 84 | } |
83 | }, | 85 | }, |
@@ -238,19 +240,6 @@ exports.ZoomTool = Montage.create(DrawingTool, { | |||
238 | var p1 = [this._layerX, this._layerY, 0]; | 240 | var p1 = [this._layerX, this._layerY, 0]; |
239 | globalPt = vecUtils.vecAdd(3, p0, p1); | 241 | globalPt = vecUtils.vecAdd(3, p0, p1); |
240 | vecUtils.vecScale(3, globalPt, 0.5); | 242 | vecUtils.vecScale(3, globalPt, 0.5); |
241 | |||
242 | var hitRec = snapManager.snap( globalPt[0], globalPt[1], true ); | ||
243 | if (hitRec) | ||
244 | { | ||
245 | var elt = hitRec.getElement(); | ||
246 | if (elt) | ||
247 | { | ||
248 | // console.log( "hit: " + hitRec.getElement().id ); | ||
249 | var localToGlobalMat = viewUtils.getLocalToGlobalMatrix( elt ); | ||
250 | var localPt = hitRec.calculateElementPreTransformScreenPoint(); | ||
251 | globalPt = MathUtils.transformAndDivideHomogeneousPoint( localPt, localToGlobalMat ); | ||
252 | } | ||
253 | } | ||
254 | } | 243 | } |
255 | else if (this._mode === "doubleClickReset") | 244 | else if (this._mode === "doubleClickReset") |
256 | { | 245 | { |
@@ -270,19 +259,9 @@ exports.ZoomTool = Montage.create(DrawingTool, { | |||
270 | } | 259 | } |
271 | else if (this._mode === "mouseWheelZoom") | 260 | else if (this._mode === "mouseWheelZoom") |
272 | { | 261 | { |
273 | if (userContent) | 262 | var w = this.application.ninja.stage._canvas.width, |
274 | { | 263 | h = this.application.ninja.stage._canvas.height; |
275 | var w = userContent.offsetWidth, | 264 | globalPt = [w/2, h/2, 0]; |
276 | h = userContent.offsetHeight; | ||
277 | if(userContent.width) | ||
278 | w = userContent.width; | ||
279 | if(userContent.height) | ||
280 | h = userContent.height; | ||
281 | var localPt = [ w/2, h/2, 0]; | ||
282 | globalPt = viewUtils.localToGlobal( localPt, userContent ); | ||
283 | } | ||
284 | else | ||
285 | globalPt = [0,0,0]; | ||
286 | } | 265 | } |
287 | else | 266 | else |
288 | { | 267 | { |