mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
Refactored 90 degrees rotation button's actions.
This commit is contained in:
parent
ec0f55098a
commit
43d3949dd1
@ -526,10 +526,4 @@ function setElementTransform( element, rule ) {
|
||||
element.style.transform = rule;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}( OpenSeadragon ));
|
||||
|
@ -3476,20 +3476,11 @@ function onFullScreen() {
|
||||
function onRotateLeft() {
|
||||
if ( this.viewport ) {
|
||||
var currRotation = this.viewport.getRotation();
|
||||
|
||||
if ( this.viewport.flipped ){
|
||||
if (currRotation === 270) {
|
||||
currRotation = 0;
|
||||
}
|
||||
else {
|
||||
currRotation += 90;
|
||||
}
|
||||
currRotation = $.positiveModulo(currRotation + 90, 360);
|
||||
} else {
|
||||
if (currRotation === 0) {
|
||||
currRotation = 270;
|
||||
}
|
||||
else {
|
||||
currRotation -= 90;
|
||||
}
|
||||
currRotation = $.positiveModulo(currRotation - 90, 360);
|
||||
}
|
||||
this.viewport.setRotation(currRotation);
|
||||
}
|
||||
@ -3501,20 +3492,11 @@ function onRotateLeft() {
|
||||
function onRotateRight() {
|
||||
if ( this.viewport ) {
|
||||
var currRotation = this.viewport.getRotation();
|
||||
|
||||
if ( this.viewport.flipped ){
|
||||
if (currRotation === 0) {
|
||||
currRotation = 270;
|
||||
}
|
||||
else {
|
||||
currRotation -= 90;
|
||||
}
|
||||
currRotation = $.positiveModulo(currRotation - 90, 360);
|
||||
} else {
|
||||
if (currRotation === 270) {
|
||||
currRotation = 0;
|
||||
}
|
||||
else {
|
||||
currRotation += 90;
|
||||
}
|
||||
currRotation = $.positiveModulo(currRotation + 90, 360);
|
||||
}
|
||||
this.viewport.setRotation(currRotation);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user