mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +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
|
/* Flip navigator element
|
||||||
*/
|
*/
|
||||||
toggleFlip: function() {
|
setFlip: function() {
|
||||||
this.viewport.flipped = !this.viewport.flipped;
|
this.viewport.toggleFlip();
|
||||||
|
|
||||||
this.setDisplayTransform(this.viewer.viewport.flipped ? "scale(-1,1)" : "scale(1,1)");
|
this.setDisplayTransform(this.viewer.viewport.flipped ? "scale(-1,1)" : "scale(1,1)");
|
||||||
this.viewport.viewer.forceRedraw();
|
this.viewport.viewer.forceRedraw();
|
||||||
|
@ -206,6 +206,9 @@
|
|||||||
* @property {Number} [degrees=0]
|
* @property {Number} [degrees=0]
|
||||||
* Initial rotation.
|
* Initial rotation.
|
||||||
*
|
*
|
||||||
|
* @property {Boolean} [flip=false]
|
||||||
|
* Initial flip state.
|
||||||
|
*
|
||||||
* @property {Number} [minZoomLevel=null]
|
* @property {Number} [minZoomLevel=null]
|
||||||
*
|
*
|
||||||
* @property {Number} [maxZoomLevel=null]
|
* @property {Number} [maxZoomLevel=null]
|
||||||
|
@ -367,6 +367,7 @@ $.Viewer = function( options ) {
|
|||||||
maxZoomLevel: this.maxZoomLevel,
|
maxZoomLevel: this.maxZoomLevel,
|
||||||
viewer: this,
|
viewer: this,
|
||||||
degrees: this.degrees,
|
degrees: this.degrees,
|
||||||
|
flipped: this.flipped,
|
||||||
navigatorRotate: this.navigatorRotate,
|
navigatorRotate: this.navigatorRotate,
|
||||||
homeFillsViewer: this.homeFillsViewer,
|
homeFillsViewer: this.homeFillsViewer,
|
||||||
margins: this.viewportMargins
|
margins: this.viewportMargins
|
||||||
|
@ -1525,12 +1525,19 @@ $.Viewport.prototype = {
|
|||||||
* Toggle flip state and demands a new drawing on navigator and viewer objects.
|
* Toggle flip state and demands a new drawing on navigator and viewer objects.
|
||||||
*/
|
*/
|
||||||
toggleFlip: function() {
|
toggleFlip: function() {
|
||||||
this.flipped = !this.flipped;
|
this.setFlip(!this.getFlip());
|
||||||
if(this.viewer.navigator){
|
if(this.viewer.navigator){
|
||||||
this.viewer.navigator.toggleFlip();
|
this.viewer.navigator.setFlip();
|
||||||
}
|
}
|
||||||
this.viewer._forceRedraw = !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