From 194d1c060692516f27d375d79705208bf6d92fca Mon Sep 17 00:00:00 2001 From: Nelson Campos Date: Thu, 12 Apr 2018 10:36:34 +0100 Subject: [PATCH] Documentation comments --- src/viewport.js | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/viewport.js b/src/viewport.js index 1f7b7e8f..132e88c4 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -1522,22 +1522,52 @@ $.Viewport.prototype = { }, /** - * Toggle flip state and demands a new drawing on navigator and viewer objects. - */ + * Toggles flip state and demands a new drawing on navigator and viewer objects. + * @function + * @return {OpenSeadragon.Viewport} Chainable. + */ toggleFlip: function() { this.setFlip(!this.getFlip()); if(this.viewer.navigator){ this.viewer.navigator.setFlip(); } this.viewer.forceRedraw(); + return this; }, + + /** + * Gets flip state stored on viewport. + * @function + * @return {Boolean} Flip state. + */ getFlip: function() { return this.flipped; }, + + /** + * Sets flip state according to the state input argument. + * @function + * @return {OpenSeadragon.Viewport} Chainable. + */ setFlip: function( state ) { + if ( this.flipped != state ) { + /** + * 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}); + } + this.flipped = state; + return this; } };