mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
Adds option to set rotation increment for nav buttons and keyboard; Issue 1518
This commit is contained in:
parent
105801b6fa
commit
2dd8a65e63
@ -271,6 +271,9 @@
|
||||
* events between different devices, causing the faster devices to slow down enough to make the zoom control
|
||||
* more manageable.
|
||||
*
|
||||
* @property {Number} [rotationIncrement=90]
|
||||
* The number of degrees to rotate right or left when the rotate buttons or keyboard shortcuts are activated.
|
||||
*
|
||||
* @property {Number} [pixelsPerWheelLine=40]
|
||||
* For pixel-resolution scrolling devices, the number of pixels equal to one scroll line.
|
||||
*
|
||||
@ -1137,6 +1140,7 @@ function OpenSeadragon( options ){
|
||||
autoResize: true,
|
||||
preserveImageSizeOnResize: false, // requires autoResize=true
|
||||
minScrollDeltaTime: 50,
|
||||
rotationIncrement: 90,
|
||||
|
||||
//DEFAULT CONTROL SETTINGS
|
||||
showSequenceControl: true, //SEQUENCE
|
||||
|
@ -2640,19 +2640,19 @@ function onCanvasKeyPress( event ) {
|
||||
this.viewport.applyConstraints();
|
||||
}
|
||||
return false;
|
||||
case 114: //r - 90 degrees clockwise rotation
|
||||
case 114: //r - clockwise rotation
|
||||
if(this.viewport.flipped){
|
||||
this.viewport.setRotation(this.viewport.degrees - 90);
|
||||
this.viewport.setRotation($.positiveModulo(this.viewport.degrees - this.rotationIncrement, 360));
|
||||
} else{
|
||||
this.viewport.setRotation(this.viewport.degrees + 90);
|
||||
this.viewport.setRotation($.positiveModulo(this.viewport.degrees + this.rotationIncrement, 360));
|
||||
}
|
||||
this.viewport.applyConstraints();
|
||||
return false;
|
||||
case 82: //R - 90 degrees counterclockwise rotation
|
||||
case 82: //R - counterclockwise rotation
|
||||
if(this.viewport.flipped){
|
||||
this.viewport.setRotation(this.viewport.degrees + 90);
|
||||
this.viewport.setRotation($.positiveModulo(this.viewport.degrees + this.rotationIncrement, 360));
|
||||
} else{
|
||||
this.viewport.setRotation(this.viewport.degrees - 90);
|
||||
this.viewport.setRotation($.positiveModulo(this.viewport.degrees - this.rotationIncrement, 360));
|
||||
}
|
||||
this.viewport.applyConstraints();
|
||||
return false;
|
||||
@ -3490,38 +3490,31 @@ function onFullScreen() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: The current rotation feature is limited to 90 degree turns.
|
||||
*/
|
||||
function onRotateLeft() {
|
||||
if ( this.viewport ) {
|
||||
var currRotation = this.viewport.getRotation();
|
||||
|
||||
if ( this.viewport.flipped ){
|
||||
currRotation = $.positiveModulo(currRotation + 90, 360);
|
||||
currRotation = $.positiveModulo(currRotation + this.rotationIncrement, 360);
|
||||
} else {
|
||||
currRotation = $.positiveModulo(currRotation - 90, 360);
|
||||
currRotation = $.positiveModulo(currRotation - this.rotationIncrement, 360);
|
||||
}
|
||||
this.viewport.setRotation(currRotation);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: The current rotation feature is limited to 90 degree turns.
|
||||
*/
|
||||
function onRotateRight() {
|
||||
if ( this.viewport ) {
|
||||
var currRotation = this.viewport.getRotation();
|
||||
|
||||
if ( this.viewport.flipped ){
|
||||
currRotation = $.positiveModulo(currRotation - 90, 360);
|
||||
currRotation = $.positiveModulo(currRotation - this.rotationIncrement, 360);
|
||||
} else {
|
||||
currRotation = $.positiveModulo(currRotation + 90, 360);
|
||||
currRotation = $.positiveModulo(currRotation + this.rotationIncrement, 360);
|
||||
}
|
||||
this.viewport.setRotation(currRotation);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: When pressed flip control button
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user