mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 22:56:11 +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
|
* events between different devices, causing the faster devices to slow down enough to make the zoom control
|
||||||
* more manageable.
|
* 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]
|
* @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.
|
||||||
*
|
*
|
||||||
@ -1137,6 +1140,7 @@ function OpenSeadragon( options ){
|
|||||||
autoResize: true,
|
autoResize: true,
|
||||||
preserveImageSizeOnResize: false, // requires autoResize=true
|
preserveImageSizeOnResize: false, // requires autoResize=true
|
||||||
minScrollDeltaTime: 50,
|
minScrollDeltaTime: 50,
|
||||||
|
rotationIncrement: 90,
|
||||||
|
|
||||||
//DEFAULT CONTROL SETTINGS
|
//DEFAULT CONTROL SETTINGS
|
||||||
showSequenceControl: true, //SEQUENCE
|
showSequenceControl: true, //SEQUENCE
|
||||||
|
@ -2640,19 +2640,19 @@ function onCanvasKeyPress( event ) {
|
|||||||
this.viewport.applyConstraints();
|
this.viewport.applyConstraints();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case 114: //r - 90 degrees clockwise rotation
|
case 114: //r - clockwise rotation
|
||||||
if(this.viewport.flipped){
|
if(this.viewport.flipped){
|
||||||
this.viewport.setRotation(this.viewport.degrees - 90);
|
this.viewport.setRotation($.positiveModulo(this.viewport.degrees - this.rotationIncrement, 360));
|
||||||
} else{
|
} else{
|
||||||
this.viewport.setRotation(this.viewport.degrees + 90);
|
this.viewport.setRotation($.positiveModulo(this.viewport.degrees + this.rotationIncrement, 360));
|
||||||
}
|
}
|
||||||
this.viewport.applyConstraints();
|
this.viewport.applyConstraints();
|
||||||
return false;
|
return false;
|
||||||
case 82: //R - 90 degrees counterclockwise rotation
|
case 82: //R - counterclockwise rotation
|
||||||
if(this.viewport.flipped){
|
if(this.viewport.flipped){
|
||||||
this.viewport.setRotation(this.viewport.degrees + 90);
|
this.viewport.setRotation($.positiveModulo(this.viewport.degrees + this.rotationIncrement, 360));
|
||||||
} else{
|
} else{
|
||||||
this.viewport.setRotation(this.viewport.degrees - 90);
|
this.viewport.setRotation($.positiveModulo(this.viewport.degrees - this.rotationIncrement, 360));
|
||||||
}
|
}
|
||||||
this.viewport.applyConstraints();
|
this.viewport.applyConstraints();
|
||||||
return false;
|
return false;
|
||||||
@ -3490,38 +3490,31 @@ function onFullScreen() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Note: The current rotation feature is limited to 90 degree turns.
|
|
||||||
*/
|
|
||||||
function onRotateLeft() {
|
function onRotateLeft() {
|
||||||
if ( this.viewport ) {
|
if ( this.viewport ) {
|
||||||
var currRotation = this.viewport.getRotation();
|
var currRotation = this.viewport.getRotation();
|
||||||
|
|
||||||
if ( this.viewport.flipped ){
|
if ( this.viewport.flipped ){
|
||||||
currRotation = $.positiveModulo(currRotation + 90, 360);
|
currRotation = $.positiveModulo(currRotation + this.rotationIncrement, 360);
|
||||||
} else {
|
} else {
|
||||||
currRotation = $.positiveModulo(currRotation - 90, 360);
|
currRotation = $.positiveModulo(currRotation - this.rotationIncrement, 360);
|
||||||
}
|
}
|
||||||
this.viewport.setRotation(currRotation);
|
this.viewport.setRotation(currRotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Note: The current rotation feature is limited to 90 degree turns.
|
|
||||||
*/
|
|
||||||
function onRotateRight() {
|
function onRotateRight() {
|
||||||
if ( this.viewport ) {
|
if ( this.viewport ) {
|
||||||
var currRotation = this.viewport.getRotation();
|
var currRotation = this.viewport.getRotation();
|
||||||
|
|
||||||
if ( this.viewport.flipped ){
|
if ( this.viewport.flipped ){
|
||||||
currRotation = $.positiveModulo(currRotation - 90, 360);
|
currRotation = $.positiveModulo(currRotation - this.rotationIncrement, 360);
|
||||||
} else {
|
} else {
|
||||||
currRotation = $.positiveModulo(currRotation + 90, 360);
|
currRotation = $.positiveModulo(currRotation + this.rotationIncrement, 360);
|
||||||
}
|
}
|
||||||
this.viewport.setRotation(currRotation);
|
this.viewport.setRotation(currRotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: When pressed flip control button
|
* Note: When pressed flip control button
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user