Refactored 90 degrees rotation button's actions.

This commit is contained in:
Nelson Campos 2018-04-17 11:19:15 +01:00
parent ec0f55098a
commit 43d3949dd1
2 changed files with 6 additions and 30 deletions

View File

@ -526,10 +526,4 @@ function setElementTransform( element, rule ) {
element.style.transform = rule;
}
}( OpenSeadragon ));

View File

@ -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);
}