Fixed Arrowkey panning bug

This commit is contained in:
Jachimike Onuoha 2021-12-02 14:45:55 -05:00
parent 2edf48e880
commit 1fde705785
2 changed files with 5 additions and 7 deletions

View File

@ -2728,8 +2728,8 @@ function onCanvasKeyPress( event ) {
var canvasKeyPressEventArgs = { var canvasKeyPressEventArgs = {
originalEvent: event.originalEvent, originalEvent: event.originalEvent,
preventDefaultAction: false, preventDefaultAction: false,
preventVerticalPan: event.preventVerticalPan, preventVerticalPan: !this.panVertical,
preventHorizontalPan: event.preventHorizontalPan preventHorizontalPan: !this.panHorizontal
}; };
// This event is documented in onCanvasKeyDown // This event is documented in onCanvasKeyDown
@ -2779,8 +2779,8 @@ function onCanvasKeyPress( event ) {
break; break;
case 97://a case 97://a
if (!canvasKeyPressEventArgs.preventHorizontalPan) { if (!canvasKeyPressEventArgs.preventHorizontalPan) {
this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(-40, 0))); this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(-40, 0)));
this.viewport.applyConstraints(); this.viewport.applyConstraints();
} }
event.preventDefault = true; event.preventDefault = true;
break; break;

View File

@ -25,9 +25,7 @@
id: "contentDiv", id: "contentDiv",
prefixUrl: "../../build/openseadragon/images/", prefixUrl: "../../build/openseadragon/images/",
tileSources: "../data/testpattern.dzi", tileSources: "../data/testpattern.dzi",
showNavigator:true, showNavigator:true
panVertical: false,
panHorizontal: true
}); });
</script> </script>
</body> </body>