mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-24 22:26:10 +03:00
code simplification and impro^Cments on toggleFlip function
This commit is contained in:
parent
b8a4f7e7a0
commit
84dc60632c
@ -276,8 +276,8 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /*
|
||||
/**
|
||||
/* Flip navigator element
|
||||
*/
|
||||
toggleFlip: function() {
|
||||
this.viewport.flipped = !this.viewport.flipped;
|
||||
setFlip: function() {
|
||||
this.viewport.toggleFlip();
|
||||
|
||||
this.setDisplayTransform(this.viewer.viewport.flipped ? "scale(-1,1)" : "scale(1,1)");
|
||||
this.viewport.viewer.forceRedraw();
|
||||
|
@ -206,6 +206,9 @@
|
||||
* @property {Number} [degrees=0]
|
||||
* Initial rotation.
|
||||
*
|
||||
* @property {Boolean} [flip=false]
|
||||
* Initial flip state.
|
||||
*
|
||||
* @property {Number} [minZoomLevel=null]
|
||||
*
|
||||
* @property {Number} [maxZoomLevel=null]
|
||||
|
@ -367,6 +367,7 @@ $.Viewer = function( options ) {
|
||||
maxZoomLevel: this.maxZoomLevel,
|
||||
viewer: this,
|
||||
degrees: this.degrees,
|
||||
flipped: this.flipped,
|
||||
navigatorRotate: this.navigatorRotate,
|
||||
homeFillsViewer: this.homeFillsViewer,
|
||||
margins: this.viewportMargins
|
||||
|
@ -1525,12 +1525,19 @@ $.Viewport.prototype = {
|
||||
* Toggle flip state and demands a new drawing on navigator and viewer objects.
|
||||
*/
|
||||
toggleFlip: function() {
|
||||
this.flipped = !this.flipped;
|
||||
this.setFlip(!this.getFlip());
|
||||
if(this.viewer.navigator){
|
||||
this.viewer.navigator.toggleFlip();
|
||||
this.viewer.navigator.setFlip();
|
||||
}
|
||||
this.viewer._forceRedraw = !this.viewer._forceRedraw;
|
||||
this.viewer.forceRedraw();
|
||||
},
|
||||
|
||||
getFlip: function() {
|
||||
return this.flipped;
|
||||
},
|
||||
|
||||
setFlip: function( state ) {
|
||||
this.flipped = state;
|
||||
}
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user