From 715f95cacead0025a57823e4cefa22e618f15df0 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 1 Feb 2012 14:00:06 -0800 Subject: mouse wheel for zoom tool --- js/tools/ZoomTool.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'js/tools/ZoomTool.js') 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, { if(wasSelected) { this.AddCustomFeedback(); this.eventManager.addEventListener( "toolDoubleClick", this, false); + this.application.ninja.stage.drawingCanvas.addEventListener("mousewheel", this, false); } else { this.RemoveCustomFeedback(); this.eventManager.removeEventListener( "toolDoubleClick", this, false); + this.application.ninja.stage.drawingCanvas.removeEventListener("mousewheel", this, false); } } }, @@ -270,19 +272,9 @@ exports.ZoomTool = Montage.create(DrawingTool, { } else if (this._mode === "mouseWheelZoom") { - if (userContent) - { - var w = userContent.offsetWidth, - h = userContent.offsetHeight; - if(userContent.width) - w = userContent.width; - if(userContent.height) - h = userContent.height; - var localPt = [ w/2, h/2, 0]; - globalPt = viewUtils.localToGlobal( localPt, userContent ); - } - else - globalPt = [0,0,0]; + var w = this.application.ninja.stage._canvas.width, + h = this.application.ninja.stage._canvas.height; + globalPt = [w/2, h/2, 0]; } else { -- cgit v1.2.3 From 5a288b9d3f8e6690149978d9d0e7bea98cc81312 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 1 Feb 2012 14:09:24 -0800 Subject: Fix for a marquee zoom bug. --- js/tools/ZoomTool.js | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'js/tools/ZoomTool.js') diff --git a/js/tools/ZoomTool.js b/js/tools/ZoomTool.js index 913dc02a..73297d16 100644 --- a/js/tools/ZoomTool.js +++ b/js/tools/ZoomTool.js @@ -240,19 +240,6 @@ exports.ZoomTool = Montage.create(DrawingTool, { var p1 = [this._layerX, this._layerY, 0]; globalPt = vecUtils.vecAdd(3, p0, p1); vecUtils.vecScale(3, globalPt, 0.5); - - var hitRec = snapManager.snap( globalPt[0], globalPt[1], true ); - if (hitRec) - { - var elt = hitRec.getElement(); - if (elt) - { -// console.log( "hit: " + hitRec.getElement().id ); - var localToGlobalMat = viewUtils.getLocalToGlobalMatrix( elt ); - var localPt = hitRec.calculateElementPreTransformScreenPoint(); - globalPt = MathUtils.transformAndDivideHomogeneousPoint( localPt, localToGlobalMat ); - } - } } else if (this._mode === "doubleClickReset") { -- cgit v1.2.3