From a672ca978546e81456ff323278aeddc71f9af121 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Thu, 7 Aug 2014 10:50:38 +0100 Subject: [PATCH] Fixes incorrect flick direction after image is rotated. --- src/viewer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index 7ba1e7c0..67944456 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -2382,8 +2382,8 @@ function onCanvasDragEnd( event ) { if ( !event.preventDefaultAction && this.viewport ) { gestureSettings = this.gestureSettingsByDeviceType( event.pointerType ); if ( gestureSettings.flickEnabled && event.speed >= gestureSettings.flickMinSpeed ) { - var amplitudeX = gestureSettings.flickMomentum * ( event.speed * Math.cos( event.direction ) ), - amplitudeY = gestureSettings.flickMomentum * ( event.speed * Math.sin( event.direction ) ), + var amplitudeX = gestureSettings.flickMomentum * ( event.speed * Math.cos( event.direction - (Math.PI / 180 * this.viewport.degrees) ) ), + amplitudeY = gestureSettings.flickMomentum * ( event.speed * Math.sin( event.direction - (Math.PI / 180 * this.viewport.degrees) ) ), center = this.viewport.pixelFromPoint( this.viewport.getCenter( true ) ), target = this.viewport.pointFromPixel( new $.Point( center.x - amplitudeX, center.y - amplitudeY ) ); if( !this.panHorizontal ) {