Fix flick gesture with rotation. Fix #869

This commit is contained in:
Antoine Vandecreme 2016-03-20 10:04:23 -04:00
parent 71f93a27cd
commit 2740792df3

View File

@ -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;
} }