Pinch zoom fix

The existing code failed on iPhone Safari iOS 6.x - event.detail was
always 0 causing only zoom out behavior.
This commit is contained in:
Mark Salsbery 2013-10-03 15:30:40 -07:00
parent 5ce3da2548
commit d55b2e7703

View File

@ -1229,13 +1229,15 @@
if ( Math.abs( THIS[ tracker.hash ].lastPinchDelta - pinchDelta ) > 75 ) { if ( Math.abs( THIS[ tracker.hash ].lastPinchDelta - pinchDelta ) > 75 ) {
//$.console.debug( "pinch delta : " + pinchDelta + " | previous : " + THIS[ tracker.hash ].lastPinchDelta); //$.console.debug( "pinch delta : " + pinchDelta + " | previous : " + THIS[ tracker.hash ].lastPinchDelta);
// Adjust the original event enough to simulate a mouse wheel scroll // Simulate a mouse wheel scroll event
event.shiftKey = event.shiftKey || false; var simulatedEvent = {
event.pageX = THIS[ tracker.hash ].pinchMidpoint.x; shiftKey: event.shiftKey || false,
event.pageY = THIS[ tracker.hash ].pinchMidpoint.y; pageX: THIS[ tracker.hash ].pinchMidpoint.x,
event.detail = ( THIS[ tracker.hash ].lastPinchDelta > pinchDelta ) ? 1 : -1; 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; THIS[ tracker.hash ].lastPinchDelta = pinchDelta;
} }