From d55b2e77031095a27554ef6f759d7acd90fd3e2b Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Thu, 3 Oct 2013 15:30:40 -0700 Subject: [PATCH] Pinch zoom fix The existing code failed on iPhone Safari iOS 6.x - event.detail was always 0 causing only zoom out behavior. --- src/mousetracker.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mousetracker.js b/src/mousetracker.js index 5161c879..fba7400e 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -1229,13 +1229,15 @@ if ( Math.abs( THIS[ tracker.hash ].lastPinchDelta - pinchDelta ) > 75 ) { //$.console.debug( "pinch delta : " + pinchDelta + " | previous : " + THIS[ tracker.hash ].lastPinchDelta); - // Adjust the original event enough to simulate a mouse wheel scroll - event.shiftKey = event.shiftKey || false; - event.pageX = THIS[ tracker.hash ].pinchMidpoint.x; - event.pageY = THIS[ tracker.hash ].pinchMidpoint.y; - event.detail = ( THIS[ tracker.hash ].lastPinchDelta > pinchDelta ) ? 1 : -1; + // Simulate a mouse wheel scroll event + var simulatedEvent = { + shiftKey: event.shiftKey || false, + pageX: THIS[ tracker.hash ].pinchMidpoint.x, + pageY: THIS[ tracker.hash ].pinchMidpoint.y, + detail: ( THIS[ tracker.hash ].lastPinchDelta > pinchDelta ) ? 1 : -1 + }; - onMouseWheelSpin( tracker, event, true ); + onMouseWheelSpin( tracker, simulatedEvent, true ); THIS[ tracker.hash ].lastPinchDelta = pinchDelta; }