mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16: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 ) {
|
if ( !event.preventDefaultAction && this.viewport ) {
|
||||||
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
gestureSettings = this.gestureSettingsByDeviceType( event.pointerType );
|
||||||
if ( gestureSettings.flickEnabled && event.speed >= gestureSettings.flickMinSpeed ) {
|
if (gestureSettings.flickEnabled &&
|
||||||
var amplitudeX = gestureSettings.flickMomentum * ( event.speed * Math.cos( event.direction - (Math.PI / 180 * this.viewport.degrees) ) ),
|
event.speed >= gestureSettings.flickMinSpeed) {
|
||||||
amplitudeY = gestureSettings.flickMomentum * ( event.speed * Math.sin( event.direction - (Math.PI / 180 * this.viewport.degrees) ) ),
|
var amplitudeX = gestureSettings.flickMomentum * event.speed *
|
||||||
center = this.viewport.pixelFromPoint( this.viewport.getCenter( true ) ),
|
Math.cos(event.direction);
|
||||||
target = this.viewport.pointFromPixel( new $.Point( center.x - amplitudeX, center.y - amplitudeY ) );
|
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 ) {
|
if( !this.panHorizontal ) {
|
||||||
target.x = center.x;
|
target.x = center.x;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user