mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +03:00
Fix flick gesture with rotation. Fix #869
This commit is contained in:
parent
71f93a27cd
commit
2740792df3
@ -2546,11 +2546,16 @@ 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 - (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 (gestureSettings.flickEnabled &&
|
||||
event.speed >= gestureSettings.flickMinSpeed) {
|
||||
var amplitudeX = gestureSettings.flickMomentum * event.speed *
|
||||
Math.cos(event.direction);
|
||||
var amplitudeY = gestureSettings.flickMomentum * event.speed *
|
||||
Math.sin(event.direction);
|
||||
var center = this.viewport.pixelFromPoint(
|
||||
this.viewport.getCenter(true));
|
||||
var target = this.viewport.pointFromPixel(
|
||||
new $.Point(center.x - amplitudeX, center.y - amplitudeY));
|
||||
if( !this.panHorizontal ) {
|
||||
target.x = center.x;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user