Merge pull request #1171 from superbland/canvas-drag-optimisation

prevent unnecessary panBy on canvas-drag in viewer
This commit is contained in:
Ian Gilman 2017-04-25 09:38:13 -07:00 committed by GitHub
commit 80611e999a

View File

@ -2573,9 +2573,11 @@ function onCanvasDrag( event ) {
if( !this.panVertical ){
event.delta.y = 0;
}
this.viewport.panBy( this.viewport.deltaPointsFromPixels( event.delta.negate() ), gestureSettings.flickEnabled );
if( this.constrainDuringPan ){
this.viewport.applyConstraints();
if( event.delta.x !== 0 || event.delta.y !== 0 ){
this.viewport.panBy( this.viewport.deltaPointsFromPixels( event.delta.negate() ), gestureSettings.flickEnabled );
if( this.constrainDuringPan ){
this.viewport.applyConstraints();
}
}
}
}