diff --git a/changelog.txt b/changelog.txt index e3bd3156..db650743 100644 --- a/changelog.txt +++ b/changelog.txt @@ -20,6 +20,7 @@ OPENSEADRAGON CHANGELOG * Requesting keyboard focus when viewer is clicked (#537) * Arrow key navigation fixed across platforms (#565) * Removed textarea element from viewer DOM. Viewer.canvas now handles keyboard navigation (#569) +* Added setMouseNavEnabled() and isMouseNavEnabled() method overrides to Navigator (#572) 1.2.0: diff --git a/src/navigator.js b/src/navigator.js index 9e18d6ca..3638efde 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -229,6 +229,36 @@ $.Navigator = function( options ){ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /** @lends OpenSeadragon.Navigator.prototype */{ + /** + * @function + * @return {Boolean} + */ + isMouseNavEnabled: function () { + return this.element.innerTracker.isTracking(); + }, + + /** + * @function + * @param {Boolean} enabled - true to enable, false to disable + * @return {OpenSeadragon.Navigator} Chainable. + * @fires OpenSeadragon.Navigator.event:mouse-enabled + */ + setMouseNavEnabled: function( enabled ){ + this.element.innerTracker.setTracking( enabled ); + /** + * Raised when mouse/touch navigation is enabled or disabled (see {@link OpenSeadragon.Navigator#setMouseNavEnabled}). + * + * @event mouse-enabled + * @memberof OpenSeadragon.Navigator + * @type {object} + * @property {OpenSeadragon.Navigator} eventSource - A reference to the Navigator which raised the event. + * @property {Boolean} enabled + * @property {?Object} userData - Arbitrary subscriber-defined object. + */ + this.raiseEvent( 'mouse-enabled', { enabled: enabled } ); + return this; + }, + /** * Used to notify the navigator when its size has changed. * Especially useful when {@link OpenSeadragon.Options}.navigatorAutoResize is set to false and the navigator is resizable.