From 3b01014ac8893d3726acb75fd79c70225e5d4690 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Tue, 20 Jan 2015 10:26:14 -0800 Subject: [PATCH 1/5] Fixed pointer event model detection for IE 10 (#571) --- changelog.txt | 1 + src/mousetracker.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index e3bd3156..4d0ebbae 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) +* Fixed pointer event model detection for IE 10 (#571) 1.2.0: diff --git a/src/mousetracker.js b/src/mousetracker.js index 9e8f25ef..8693067e 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -988,7 +988,7 @@ $.MouseTracker.maxTouchPoints = 0; } $.MouseTracker.haveMouseEnter = false; - } else if ( window.MSPointerEvent ) { + } else if ( window.MSPointerEvent && window.navigator.msPointerEnabled ) { // IE10 $.MouseTracker.havePointerEvents = true; $.MouseTracker.subscribeEvents.push( "MSPointerOver", "MSPointerOut", "MSPointerDown", "MSPointerUp", "MSPointerMove", "MSPointerCancel" ); From 198d4de0e6f5ca926d15eac363bc2aedc639877b Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Tue, 20 Jan 2015 11:01:09 -0800 Subject: [PATCH 2/5] Added setMouseNavEnabled() and isMouseNavEnabled() method overrides to Navigator (#572) --- changelog.txt | 1 + src/navigator.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) 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. From 674a208d95b50e1f5db610c3cea0d713140caa85 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Tue, 20 Jan 2015 13:56:06 -0800 Subject: [PATCH 3/5] Replace base class innerTracker instead of using a new one --- src/navigator.js | 75 +++++++++++++----------------------------------- 1 file changed, 20 insertions(+), 55 deletions(-) diff --git a/src/navigator.js b/src/navigator.js index 3638efde..9991dbac 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -52,8 +52,7 @@ $.Navigator = function( options ){ var viewer = options.viewer, _this = this, viewerSize, - navigatorSize, - unneededElement; + navigatorSize; //We may need to create a new element and id if they did not //provide the id for the existing element @@ -168,24 +167,6 @@ $.Navigator = function( options ){ this.displayRegionContainer.style.width = "100%"; this.displayRegionContainer.style.height = "100%"; - this.element.innerTracker = new $.MouseTracker({ - element: this.element, - dragHandler: $.delegate( this, onCanvasDrag ), - clickHandler: $.delegate( this, onCanvasClick ), - releaseHandler: $.delegate( this, onCanvasRelease ), - scrollHandler: $.delegate( this, onCanvasScroll ) - }).setTracking( true ); - - /*this.displayRegion.outerTracker = new $.MouseTracker({ - element: this.container, - clickTimeThreshold: this.clickTimeThreshold, - clickDistThreshold: this.clickDistThreshold, - enterHandler: $.delegate( this, onContainerEnter ), - exitHandler: $.delegate( this, onContainerExit ), - releaseHandler: $.delegate( this, onContainerRelease ) - }).setTracking( this.mouseNavEnabled ? true : false ); // always tracking*/ - - viewer.addControl( this.element, options.controlOptions @@ -211,10 +192,6 @@ $.Navigator = function( options ){ this.displayRegionContainer.appendChild(this.displayRegion); this.element.getElementsByTagName('div')[0].appendChild(this.displayRegionContainer); - unneededElement = this.element.getElementsByTagName('textarea')[0]; - if (unneededElement) { - unneededElement.parentNode.removeChild(unneededElement); - } if (options.navigatorRotate) { @@ -223,42 +200,30 @@ $.Navigator = function( options ){ _setTransformRotate(_this.displayRegion, -args.degrees); _this.viewport.setRotation(args.degrees); }); - } + + // Remove the base class' (Viewer's) innerTracker and replace it with our own + this.innerTracker.destroy(); + this.innerTracker = new $.MouseTracker({ + element: this.element, + dragHandler: $.delegate( this, onCanvasDrag ), + clickHandler: $.delegate( this, onCanvasClick ), + releaseHandler: $.delegate( this, onCanvasRelease ), + scrollHandler: $.delegate( this, onCanvasScroll ) + }).setTracking( true ); + + /*this.displayRegion.outerTracker = new $.MouseTracker({ + element: this.container, + clickTimeThreshold: this.clickTimeThreshold, + clickDistThreshold: this.clickDistThreshold, + enterHandler: $.delegate( this, onContainerEnter ), + exitHandler: $.delegate( this, onContainerExit ), + releaseHandler: $.delegate( this, onContainerRelease ) + }).setTracking( this.mouseNavEnabled ? true : false ); // always tracking*/ }; $.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. From 269f9ee71d52d149eee07f70215184bedb062833 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Tue, 20 Jan 2015 17:45:13 -0800 Subject: [PATCH 4/5] changelog update --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 42812042..4eb7f7e7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -21,7 +21,7 @@ OPENSEADRAGON CHANGELOG * Arrow key navigation fixed across platforms (#565) * Removed textarea element from viewer DOM. Viewer.canvas now handles keyboard navigation (#569) * Removed 'position' property from MouseTracker keyDownHandler/keyUpHandler/keyHandler functions (#573) -* Added setMouseNavEnabled() and isMouseNavEnabled() method overrides to Navigator (#572) +* Added setMouseNavEnabled() support to Navigator (#572) 1.2.0: From 406005c8c9eda35d4ab38f6e4de374d4a9eaae86 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Wed, 21 Jan 2015 09:42:03 -0800 Subject: [PATCH 5/5] Removed dead code --- src/navigator.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/navigator.js b/src/navigator.js index 9991dbac..fb0756e8 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -212,14 +212,6 @@ $.Navigator = function( options ){ scrollHandler: $.delegate( this, onCanvasScroll ) }).setTracking( true ); - /*this.displayRegion.outerTracker = new $.MouseTracker({ - element: this.container, - clickTimeThreshold: this.clickTimeThreshold, - clickDistThreshold: this.clickDistThreshold, - enterHandler: $.delegate( this, onContainerEnter ), - exitHandler: $.delegate( this, onContainerExit ), - releaseHandler: $.delegate( this, onContainerRelease ) - }).setTracking( this.mouseNavEnabled ? true : false ); // always tracking*/ }; $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /** @lends OpenSeadragon.Navigator.prototype */{