aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorhwc4872012-02-01 14:00:06 -0800
committerhwc4872012-02-01 14:00:06 -0800
commit715f95cacead0025a57823e4cefa22e618f15df0 (patch)
treeb254ce249a240262f1e46b9a5f166370e74593a5 /js/tools
parent799369e153baf92eb10f26e91a1ab664900da8ed (diff)
downloadninja-715f95cacead0025a57823e4cefa22e618f15df0.tar.gz
mouse wheel for zoom tool
Diffstat (limited to 'js/tools')
-rw-r--r--js/tools/ZoomTool.js18
1 files changed, 5 insertions, 13 deletions
diff --git a/js/tools/ZoomTool.js b/js/tools/ZoomTool.js
index cabf3a3d..913dc02a 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 },
@@ -270,19 +272,9 @@ exports.ZoomTool = Montage.create(DrawingTool, {
270 } 272 }
271 else if (this._mode === "mouseWheelZoom") 273 else if (this._mode === "mouseWheelZoom")
272 { 274 {
273 if (userContent) 275 var w = this.application.ninja.stage._canvas.width,
274 { 276 h = this.application.ninja.stage._canvas.height;
275 var w = userContent.offsetWidth, 277 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 } 278 }
287 else 279 else
288 { 280 {