mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-28 16:16:08 +03:00
Simplifies viewport setFlip function.
This commit is contained in:
parent
c2fd5322e2
commit
ec0f55098a
@ -1549,29 +1549,27 @@ $.Viewport.prototype = {
|
|||||||
* @return {OpenSeadragon.Viewport} Chainable.
|
* @return {OpenSeadragon.Viewport} Chainable.
|
||||||
*/
|
*/
|
||||||
setFlip: function( state ) {
|
setFlip: function( state ) {
|
||||||
if ( this.flipped != state ) {
|
if ( this.flipped === state ) {
|
||||||
this.flipped = state;
|
return this;
|
||||||
this.viewer.forceRedraw();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Raised when flip state has been changed.
|
|
||||||
*
|
|
||||||
* @event flip
|
|
||||||
* @memberof OpenSeadragon.Viewer
|
|
||||||
* @type {object}
|
|
||||||
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
|
|
||||||
* @property {Number} flipped - The flip state after this change.
|
|
||||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
|
||||||
*/
|
|
||||||
this.viewer.raiseEvent('flip', {"flipped": state});
|
|
||||||
} else {
|
|
||||||
this.flipped = state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.flipped = state;
|
||||||
if(this.viewer.navigator){
|
if(this.viewer.navigator){
|
||||||
this.viewer.navigator.setFlip(this.getFlip());
|
this.viewer.navigator.setFlip(this.getFlip());
|
||||||
}
|
}
|
||||||
this.viewer.forceRedraw();
|
this.viewer.forceRedraw();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Raised when flip state has been changed.
|
||||||
|
*
|
||||||
|
* @event flip
|
||||||
|
* @memberof OpenSeadragon.Viewer
|
||||||
|
* @type {object}
|
||||||
|
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised the event.
|
||||||
|
* @property {Number} flipped - The flip state after this change.
|
||||||
|
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||||
|
*/
|
||||||
|
this.viewer.raiseEvent('flip', {"flipped": state});
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user