mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
Merge pull request #1364 from j-hudecek/master
Added option pixelsPerArrowPress that sets the speed of arrow keys
This commit is contained in:
commit
c1edcac2a3
@ -266,6 +266,9 @@
|
|||||||
* @property {Number} [pixelsPerWheelLine=40]
|
* @property {Number} [pixelsPerWheelLine=40]
|
||||||
* For pixel-resolution scrolling devices, the number of pixels equal to one scroll line.
|
* For pixel-resolution scrolling devices, the number of pixels equal to one scroll line.
|
||||||
*
|
*
|
||||||
|
* @property {Number} [pixelsPerArrowPress=40]
|
||||||
|
* The number of pixels viewport moves when an arrow key is pressed.
|
||||||
|
*
|
||||||
* @property {Number} [visibilityRatio=0.5]
|
* @property {Number} [visibilityRatio=0.5]
|
||||||
* The percentage ( as a number from 0 to 1 ) of the source image which
|
* The percentage ( as a number from 0 to 1 ) of the source image which
|
||||||
* must be kept within the viewport. If the image is dragged beyond that
|
* must be kept within the viewport. If the image is dragged beyond that
|
||||||
@ -1088,6 +1091,7 @@ function OpenSeadragon( options ){
|
|||||||
smoothTileEdgesMinZoom: 1.1, //-> higher than maxZoomPixelRatio disables it
|
smoothTileEdgesMinZoom: 1.1, //-> higher than maxZoomPixelRatio disables it
|
||||||
iOSDevice: isIOSDevice(),
|
iOSDevice: isIOSDevice(),
|
||||||
pixelsPerWheelLine: 40,
|
pixelsPerWheelLine: 40,
|
||||||
|
pixelsPerArrowPress: 40,
|
||||||
autoResize: true,
|
autoResize: true,
|
||||||
preserveImageSizeOnResize: false, // requires autoResize=true
|
preserveImageSizeOnResize: false, // requires autoResize=true
|
||||||
minScrollDeltaTime: 50,
|
minScrollDeltaTime: 50,
|
||||||
|
@ -2483,7 +2483,7 @@ function onCanvasKeyDown( event ) {
|
|||||||
if ( event.shift ) {
|
if ( event.shift ) {
|
||||||
this.viewport.zoomBy(1.1);
|
this.viewport.zoomBy(1.1);
|
||||||
} else {
|
} else {
|
||||||
this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(0, -40)));
|
this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(0, -this.pixelsPerArrowPress)));
|
||||||
}
|
}
|
||||||
this.viewport.applyConstraints();
|
this.viewport.applyConstraints();
|
||||||
return false;
|
return false;
|
||||||
@ -2491,16 +2491,16 @@ function onCanvasKeyDown( event ) {
|
|||||||
if ( event.shift ) {
|
if ( event.shift ) {
|
||||||
this.viewport.zoomBy(0.9);
|
this.viewport.zoomBy(0.9);
|
||||||
} else {
|
} else {
|
||||||
this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(0, 40)));
|
this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(0, this.pixelsPerArrowPress)));
|
||||||
}
|
}
|
||||||
this.viewport.applyConstraints();
|
this.viewport.applyConstraints();
|
||||||
return false;
|
return false;
|
||||||
case 37://left arrow
|
case 37://left arrow
|
||||||
this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(-40, 0)));
|
this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(-this.pixelsPerArrowPress, 0)));
|
||||||
this.viewport.applyConstraints();
|
this.viewport.applyConstraints();
|
||||||
return false;
|
return false;
|
||||||
case 39://right arrow
|
case 39://right arrow
|
||||||
this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(40, 0)));
|
this.viewport.panBy(this.viewport.deltaPointsFromPixels(new $.Point(this.pixelsPerArrowPress, 0)));
|
||||||
this.viewport.applyConstraints();
|
this.viewport.applyConstraints();
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user