From 30b5ec04c62c27d3d528661007ce622653555de1 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Sat, 10 Jan 2015 14:49:02 -0800 Subject: [PATCH 01/11] MouseTracker Improvements * Exposed secondary pointer button (middle, right, etc.) events from MouseTracker and through viewer (#479) * MouseTracker - Improved IE 8 compatibility --- changelog.txt | 3 + src/mousetracker.js | 432 +++++++++++++++++++++++++++++++++----------- src/viewer.js | 62 ++++++- 3 files changed, 392 insertions(+), 105 deletions(-) diff --git a/changelog.txt b/changelog.txt index 779df7b5..dfb1a5a9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,9 @@ OPENSEADRAGON CHANGELOG 1.2.1: (in progress) +* Exposed secondary pointer button (middle, right, etc.) events from MouseTracker and through viewer (#479) +* MouseTracker - Improved IE 8 compatibility + 1.2.0: * New combined IIIF TileSource for 1.0 through 2.0 (#441) diff --git a/src/mousetracker.js b/src/mousetracker.js index 8e89e43a..ff4f15fa 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -72,8 +72,12 @@ * An optional handler for pointer exit. * @param {OpenSeadragon.EventHandler} [options.pressHandler=null] * An optional handler for pointer press. + * @param {OpenSeadragon.EventHandler} [options.auxPressHandler=null] + * An optional handler for pointer non-primary button press. * @param {OpenSeadragon.EventHandler} [options.releaseHandler=null] * An optional handler for pointer release. + * @param {OpenSeadragon.EventHandler} [options.auxReleaseHandler=null] + * An optional handler for pointer non-primary button release. * @param {OpenSeadragon.EventHandler} [options.moveHandler=null] * An optional handler for pointer move. * @param {OpenSeadragon.EventHandler} [options.scrollHandler=null] @@ -144,24 +148,26 @@ * @memberof OpenSeadragon.MouseTracker# */ this.dblClickDistThreshold = options.dblClickDistThreshold || $.DEFAULT_SETTINGS.dblClickDistThreshold; - this.userData = options.userData || null; - this.stopDelay = options.stopDelay || 50; + this.userData = options.userData || null; + this.stopDelay = options.stopDelay || 50; - this.enterHandler = options.enterHandler || null; - this.exitHandler = options.exitHandler || null; - this.pressHandler = options.pressHandler || null; - this.releaseHandler = options.releaseHandler || null; - this.moveHandler = options.moveHandler || null; - this.scrollHandler = options.scrollHandler || null; - this.clickHandler = options.clickHandler || null; - this.dblClickHandler = options.dblClickHandler || null; - this.dragHandler = options.dragHandler || null; - this.dragEndHandler = options.dragEndHandler || null; - this.pinchHandler = options.pinchHandler || null; - this.stopHandler = options.stopHandler || null; - this.keyHandler = options.keyHandler || null; - this.focusHandler = options.focusHandler || null; - this.blurHandler = options.blurHandler || null; + this.enterHandler = options.enterHandler || null; + this.exitHandler = options.exitHandler || null; + this.pressHandler = options.pressHandler || null; + this.auxPressHandler = options.auxPressHandler || null; + this.releaseHandler = options.releaseHandler || null; + this.auxReleaseHandler = options.auxReleaseHandler || null; + this.moveHandler = options.moveHandler || null; + this.scrollHandler = options.scrollHandler || null; + this.clickHandler = options.clickHandler || null; + this.dblClickHandler = options.dblClickHandler || null; + this.dragHandler = options.dragHandler || null; + this.dragEndHandler = options.dragEndHandler || null; + this.pinchHandler = options.pinchHandler || null; + this.stopHandler = options.stopHandler || null; + this.keyHandler = options.keyHandler || null; + this.focusHandler = options.focusHandler || null; + this.blurHandler = options.blurHandler || null; //Store private properties in a scope sealed hash map var _this = this; @@ -183,6 +189,8 @@ DOMMouseScroll: function ( event ) { onMouseWheel( _this, event ); }, MozMousePixelScroll: function ( event ) { onMouseWheel( _this, event ); }, + mouseenter: function ( event ) { onMouseEnter( _this, event ); }, // Used on IE8 only + mouseleave: function ( event ) { onMouseLeave( _this, event ); }, // Used on IE8 only mouseover: function ( event ) { onMouseOver( _this, event ); }, mouseout: function ( event ) { onMouseOut( _this, event ); }, mousedown: function ( event ) { onMouseDown( _this, event ); }, @@ -390,6 +398,34 @@ */ pressHandler: function () { }, + /** + * Implement or assign implementation to these handlers during or after + * calling the constructor. + * @function + * @param {Object} event + * @param {OpenSeadragon.MouseTracker} event.eventSource + * A reference to the tracker instance. + * @param {String} event.pointerType + * "mouse", "touch", "pen", etc. + * @param {OpenSeadragon.Point} event.position + * The position of the event relative to the tracked element. + * @param {Number} event.button + * Button which caused the event. + * -1: none, 0: primary/left, 1: aux/middle, 2: secondary/right, 3: X1/back, 4: X2/forward, 5: pen eraser. + * @param {Number} event.buttons + * Current buttons pressed. + * Combination of bit flags 0: none, 1: primary (or touch contact), 2: secondary, 4: aux (often middle), 8: X1 (often back), 16: X2 (often forward), 32: pen eraser. + * @param {Boolean} event.isTouchEvent + * True if the original event is a touch event, otherwise false. Deprecated. Use pointerType and/or originalEvent instead. + * @param {Object} event.originalEvent + * The original event object. + * @param {Boolean} event.preventDefaultAction + * Set to true to prevent the tracker subscriber from performing its default action (subscriber implementation dependent). Default: false. + * @param {Object} event.userData + * Arbitrary user-defined object. + */ + auxPressHandler: function () { }, + /** * Implement or assign implementation to these handlers during or after * calling the constructor. @@ -420,6 +456,34 @@ */ releaseHandler: function () { }, + /** + * Implement or assign implementation to these handlers during or after + * calling the constructor. + * @function + * @param {Object} event + * @param {OpenSeadragon.MouseTracker} event.eventSource + * A reference to the tracker instance. + * @param {String} event.pointerType + * "mouse", "touch", "pen", etc. + * @param {OpenSeadragon.Point} event.position + * The position of the event relative to the tracked element. + * @param {Number} event.button + * Button which caused the event. + * -1: none, 0: primary/left, 1: aux/middle, 2: secondary/right, 3: X1/back, 4: X2/forward, 5: pen eraser. + * @param {Number} event.buttons + * Current buttons pressed. + * Combination of bit flags 0: none, 1: primary (or touch contact), 2: secondary, 4: aux (often middle), 8: X1 (often back), 16: X2 (often forward), 32: pen eraser. + * @param {Boolean} event.isTouchEvent + * True if the original event is a touch event, otherwise false. Deprecated. Use pointerType and/or originalEvent instead. + * @param {Object} event.originalEvent + * The original event object. + * @param {Boolean} event.preventDefaultAction + * Set to true to prevent the tracker subscriber from performing its default action (subscriber implementation dependent). Default: false. + * @param {Object} event.userData + * Arbitrary user-defined object. + */ + auxReleaseHandler: function () { }, + /** * Implement or assign implementation to these handlers during or after * calling the constructor. @@ -838,8 +902,14 @@ $.MouseTracker.haveMouseEnter = false; } else { // Legacy W3C mouse events - $.MouseTracker.subscribeEvents.push( "mouseover", "mouseout", "mousedown", "mouseup", "mousemove" ); - $.MouseTracker.haveMouseEnter = false; + if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { + $.MouseTracker.subscribeEvents.push( "mouseenter", "mouseleave" ); + $.MouseTracker.haveMouseEnter = true; + } else { + $.MouseTracker.subscribeEvents.push( "mouseover", "mouseout" ); + $.MouseTracker.haveMouseEnter = false; + } + $.MouseTracker.subscribeEvents.push( "mousedown", "mouseup", "mousemove" ); if ( 'ontouchstart' in window ) { // iOS, Android, and other W3c Touch Event implementations (see http://www.w3.org/TR/2011/WD-touch-events-20110505) $.MouseTracker.subscribeEvents.push( "touchstart", "touchend", "touchmove", "touchcancel" ); @@ -1181,27 +1251,31 @@ * @inner */ function capturePointer( tracker, pointerType ) { - var delegate = THIS[ tracker.hash ], - pointsList = tracker.getActivePointersListByType( pointerType ), - eventParams = getCaptureEventParams( tracker, pointerType ); + var pointsList = tracker.getActivePointersListByType( pointerType ), + eventParams; pointsList.captureCount++; if ( pointsList.captureCount === 1 ) { - // We emulate mouse capture by hanging listeners on the window object. - // (Note we listen on the capture phase so the captured handlers will get called first) - $.addEvent( - $.MouseTracker.captureElement, - eventParams.upName, - eventParams.upHandler, - true - ); - $.addEvent( - $.MouseTracker.captureElement, - eventParams.moveName, - eventParams.moveHandler, - true - ); + if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { + tracker.element.setCapture( true ); + } else { + eventParams = getCaptureEventParams( tracker, pointerType ); + // We emulate mouse capture by hanging listeners on the document object. + // (Note we listen on the capture phase so the captured handlers will get called first) + $.addEvent( + $.MouseTracker.captureElement, + eventParams.upName, + eventParams.upHandler, + true + ); + $.addEvent( + $.MouseTracker.captureElement, + eventParams.moveName, + eventParams.moveHandler, + true + ); + } } } @@ -1212,27 +1286,31 @@ * @inner */ function releasePointer( tracker, pointerType ) { - var delegate = THIS[ tracker.hash ], - pointsList = tracker.getActivePointersListByType( pointerType ), - eventParams = getCaptureEventParams( tracker, pointerType ); + var pointsList = tracker.getActivePointersListByType( pointerType ), + eventParams; pointsList.captureCount--; if ( pointsList.captureCount === 0 ) { - // We emulate mouse capture by hanging listeners on the window object. - // (Note we listen on the capture phase so the captured handlers will get called first) - $.removeEvent( - $.MouseTracker.captureElement, - eventParams.moveName, - eventParams.moveHandler, - true - ); - $.removeEvent( - $.MouseTracker.captureElement, - eventParams.upName, - eventParams.upHandler, - true - ); + if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { + tracker.element.releaseCapture(); + } else { + eventParams = getCaptureEventParams( tracker, pointerType ); + // We emulate mouse capture by hanging listeners on the document object. + // (Note we listen on the capture phase so the captured handlers will get called first) + $.removeEvent( + $.MouseTracker.captureElement, + eventParams.moveName, + eventParams.moveHandler, + true + ); + $.removeEvent( + $.MouseTracker.captureElement, + eventParams.upName, + eventParams.upHandler, + true + ); + } } } @@ -1506,20 +1584,40 @@ } + /** + * Only used on IE 8 + * + * @private + * @inner + */ + function onMouseEnter( tracker, event ) { + event = $.getEvent( event ); + + handleMouseEnter( tracker, event ); + } + + /** * @private * @inner */ function onMouseOver( tracker, event ) { - var gPoint; - event = $.getEvent( event ); if ( this === event.relatedTarget || isParentChild( event.currentTarget, event.relatedTarget ) ) { return; } - gPoint = { + handleMouseEnter( tracker, event ); + } + + + /** + * @private + * @inner + */ + function handleMouseEnter( tracker, event ) { + var gPoint = { id: $.MouseTracker.mousePointerId, type: 'mouse', isPrimary: true, @@ -1531,20 +1629,40 @@ } + /** + * Only used on IE 8 + * + * @private + * @inner + */ + function onMouseLeave( tracker, event ) { + event = $.getEvent( event ); + + handleMouseExit( tracker, event ); + } + + /** * @private * @inner */ function onMouseOut( tracker, event ) { - var gPoint; - event = $.getEvent( event ); if ( this === event.relatedTarget || isParentChild( event.currentTarget, event.relatedTarget ) ) { return; } - gPoint = { + handleMouseExit( tracker, event ); + } + + + /** + * @private + * @inner + */ + function handleMouseExit( tracker, event ) { + var gPoint = { id: $.MouseTracker.mousePointerId, type: 'mouse', isPrimary: true, @@ -1556,6 +1674,31 @@ } + /** + * Returns a W3C DOM level 3 standard button value given an event.button property: + * -1 == none, 0 == primary/left, 1 == middle, 2 == secondary/right, 3 == X1/back, 4 == X2/forward, 5 == eraser (pen) + * @private + * @inner + */ + function getStandardizedButton( button ) { + if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { + // On IE 8, 0 == none, 1 == left, 2 == right, 3 == left and right, 4 == middle, 5 == left and middle, 6 == right and middle, 7 == all three + // TODO: Support chorded (multiple) button presses on IE 8? + if ( button === 1 ) { + return 0; + } else if ( button === 2 ) { + return 2; + } else if ( button === 4 ) { + return 1; + } else { + return -1; + } + } else { + return button; + } + } + + /** * @private * @inner @@ -1573,7 +1716,7 @@ currentTime: $.now() }; - if ( updatePointersDown( tracker, event, [ gPoint ], event.button ) ) { + if ( updatePointersDown( tracker, event, [ gPoint ], getStandardizedButton( event.button ) ) ) { $.stopEvent( event ); capturePointer( tracker, 'mouse' ); } @@ -1622,11 +1765,12 @@ currentTime: $.now() }; - if ( updatePointersUp( tracker, event, [ gPoint ], event.button ) ) { + if ( updatePointersUp( tracker, event, [ gPoint ], getStandardizedButton( event.button ) ) ) { releasePointer( tracker, 'mouse' ); } } + /** * @private * @inner @@ -2286,7 +2430,7 @@ * @param {Array.} gPoints * Gesture points associated with the event. * @param {Number} buttonChanged - * The button involved in the event: -1: none, 0: primary, 1: aux, 2: secondary, 3: X1, 4: X2, 5: pen eraser. + * The button involved in the event: -1: none, 0: primary/left, 1: aux/middle, 2: secondary/right, 3: X1/back, 4: X2/forward, 5: pen eraser. * Note on chorded button presses (a button pressed when another button is already pressed): In the W3C Pointer Events model, * only one pointerdown/pointerup event combo is fired. Chorded button state changes instead fire pointermove events. * @@ -2304,30 +2448,71 @@ if ( typeof event.buttons !== 'undefined' ) { pointsList.buttons = event.buttons; } else { - if ( buttonChanged === 0 ) { - // Primary - pointsList.buttons |= 1; - } else if ( buttonChanged === 1 ) { - // Aux - pointsList.buttons |= 4; - } else if ( buttonChanged === 2 ) { - // Secondary - pointsList.buttons |= 2; - } else if ( buttonChanged === 3 ) { - // X1 (Back) - pointsList.buttons |= 8; - } else if ( buttonChanged === 4 ) { - // X2 (Forward) - pointsList.buttons |= 16; - } else if ( buttonChanged === 5 ) { - // Pen Eraser - pointsList.buttons |= 32; + if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { + if ( buttonChanged === 0 ) { + // Primary + pointsList.buttons += 1; + } else if ( buttonChanged === 1 ) { + // Aux + pointsList.buttons += 4; + } else if ( buttonChanged === 2 ) { + // Secondary + pointsList.buttons += 2; + } else if ( buttonChanged === 3 ) { + // X1 (Back) + pointsList.buttons += 8; + } else if ( buttonChanged === 4 ) { + // X2 (Forward) + pointsList.buttons += 16; + } else if ( buttonChanged === 5 ) { + // Pen Eraser + pointsList.buttons += 32; + } + } else { + if ( buttonChanged === 0 ) { + // Primary + pointsList.buttons |= 1; + } else if ( buttonChanged === 1 ) { + // Aux + pointsList.buttons |= 4; + } else if ( buttonChanged === 2 ) { + // Secondary + pointsList.buttons |= 2; + } else if ( buttonChanged === 3 ) { + // X1 (Back) + pointsList.buttons |= 8; + } else if ( buttonChanged === 4 ) { + // X2 (Forward) + pointsList.buttons |= 16; + } else if ( buttonChanged === 5 ) { + // Pen Eraser + pointsList.buttons |= 32; + } } } // Only capture and track primary button, pen, and touch contacts - //if ( buttonChanged !== 0 ) { - if ( buttonChanged !== 0 && buttonChanged !== 1 ) { //TODO Remove this IE8 compatibility and use the commented line above + if ( buttonChanged !== 0 ) { + // Aux Press + if ( tracker.auxPressHandler ) { + propagate = tracker.auxPressHandler( + { + eventSource: tracker, + pointerType: gPoints[ 0 ].type, + position: getPointRelativeToAbsolute( gPoints[ 0 ].currentPos, tracker.element ), + button: buttonChanged, + buttons: pointsList.buttons, + isTouchEvent: gPoints[ 0 ].type === 'touch', + originalEvent: event, + preventDefaultAction: false, + userData: tracker.userData + } + ); + if ( propagate === false ) { + $.cancelEvent( event ); + } + } + return false; } @@ -2407,7 +2592,7 @@ * @param {Array.} gPoints * Gesture points associated with the event. * @param {Number} buttonChanged - * The button involved in the event: -1: none, 0: primary, 1: aux, 2: secondary, 3: X1, 4: X2, 5: pen eraser. + * The button involved in the event: -1: none, 0: primary/left, 1: aux/middle, 2: secondary/right, 3: X1/back, 4: X2/forward, 5: pen eraser. * Note on chorded button presses (a button pressed when another button is already pressed): In the W3C Pointer Events model, * only one pointerdown/pointerup event combo is fired. Chorded button state changes instead fire pointermove events. * @@ -2431,30 +2616,71 @@ if ( typeof event.buttons !== 'undefined' ) { pointsList.buttons = event.buttons; } else { - if ( buttonChanged === 0 ) { - // Primary - pointsList.buttons ^= ~1; - } else if ( buttonChanged === 1 ) { - // Aux - pointsList.buttons ^= ~4; - } else if ( buttonChanged === 2 ) { - // Secondary - pointsList.buttons ^= ~2; - } else if ( buttonChanged === 3 ) { - // X1 (Back) - pointsList.buttons ^= ~8; - } else if ( buttonChanged === 4 ) { - // X2 (Forward) - pointsList.buttons ^= ~16; - } else if ( buttonChanged === 5 ) { - // Pen Eraser - pointsList.buttons ^= ~32; + if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { + if ( buttonChanged === 0 ) { + // Primary + pointsList.buttons -= 1; + } else if ( buttonChanged === 1 ) { + // Aux + pointsList.buttons -= 4; + } else if ( buttonChanged === 2 ) { + // Secondary + pointsList.buttons -= 2; + } else if ( buttonChanged === 3 ) { + // X1 (Back) + pointsList.buttons -= 8; + } else if ( buttonChanged === 4 ) { + // X2 (Forward) + pointsList.buttons -= 16; + } else if ( buttonChanged === 5 ) { + // Pen Eraser + pointsList.buttons -= 32; + } + } else { + if ( buttonChanged === 0 ) { + // Primary + pointsList.buttons ^= ~1; + } else if ( buttonChanged === 1 ) { + // Aux + pointsList.buttons ^= ~4; + } else if ( buttonChanged === 2 ) { + // Secondary + pointsList.buttons ^= ~2; + } else if ( buttonChanged === 3 ) { + // X1 (Back) + pointsList.buttons ^= ~8; + } else if ( buttonChanged === 4 ) { + // X2 (Forward) + pointsList.buttons ^= ~16; + } else if ( buttonChanged === 5 ) { + // Pen Eraser + pointsList.buttons ^= ~32; + } } } // Only capture and track primary button, pen, and touch contacts - //if ( buttonChanged !== 0 ) { - if ( buttonChanged !== 0 && buttonChanged !== 1 ) { //TODO Remove this IE8 compatibility and use the commented line above + if ( buttonChanged !== 0 ) { + // Aux Release + if ( tracker.auxReleaseHandler ) { + propagate = tracker.auxReleaseHandler( + { + eventSource: tracker, + pointerType: gPoints[ 0 ].type, + position: getPointRelativeToAbsolute( gPoints[ 0 ].currentPos, tracker.element ), + button: buttonChanged, + buttons: pointsList.buttons, + isTouchEvent: gPoints[ 0 ].type === 'touch', + originalEvent: event, + preventDefaultAction: false, + userData: tracker.userData + } + ); + if ( propagate === false ) { + $.cancelEvent( event ); + } + } + return false; } diff --git a/src/viewer.js b/src/viewer.js index 39ed6294..5c8b45a8 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -390,6 +390,8 @@ $.Viewer = function( options ) { dragHandler: $.delegate( this, onCanvasDrag ), dragEndHandler: $.delegate( this, onCanvasDragEnd ), releaseHandler: $.delegate( this, onCanvasRelease ), + auxPressHandler: $.delegate( this, onCanvasAuxPress ), + auxReleaseHandler: $.delegate( this, onCanvasAuxRelease ), scrollHandler: $.delegate( this, onCanvasScroll ), pinchHandler: $.delegate( this, onCanvasPinch ) }).setTracking( this.mouseNavEnabled ? true : false ); // default state @@ -2422,7 +2424,7 @@ function onCanvasDragEnd( event ) { function onCanvasRelease( event ) { /** - * Raised when the mouse button is released or touch ends on the {@link OpenSeadragon.Viewer#canvas} element. + * Raised when the primary mouse button is released or touch ends on the {@link OpenSeadragon.Viewer#canvas} element. * * @event canvas-release * @memberof OpenSeadragon.Viewer @@ -2444,6 +2446,62 @@ function onCanvasRelease( event ) { }); } +function onCanvasAuxPress( event ) { + /** + * Raised when any non-primary pointer button is pressed on the {@link OpenSeadragon.Viewer#canvas} element. + * + * @event canvas-aux-press + * @memberof OpenSeadragon.Viewer + * @type {object} + * @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event. + * @property {OpenSeadragon.MouseTracker} tracker - A reference to the MouseTracker which originated this event. + * @property {OpenSeadragon.Point} position - The position of the event relative to the tracked element. + * @property {String} pointerType - "mouse", "touch", "pen", etc. + * @property {Number} button - Button which caused the event. + * -1: none, 0: primary/left, 1: aux/middle, 2: secondary/right, 3: X1/back, 4: X2/forward, 5: pen eraser. + * @property {Number} buttons - Current buttons pressed. + * Combination of bit flags 0: none, 1: primary (or touch contact), 2: secondary, 4: aux (often middle), 8: X1 (often back), 16: X2 (often forward), 32: pen eraser. + * @property {Object} originalEvent - The original DOM event. + * @property {?Object} userData - Arbitrary subscriber-defined object. + */ + this.raiseEvent( 'canvas-aux-press', { + tracker: event.eventSource, + position: event.position, + pointerType: event.pointerType, + button: event.button, + buttons: event.buttons, + originalEvent: event.originalEvent + }); +} + +function onCanvasAuxRelease( event ) { + /** + * Raised when any non-primary pointer button is released on the {@link OpenSeadragon.Viewer#canvas} element. + * + * @event canvas-aux-release + * @memberof OpenSeadragon.Viewer + * @type {object} + * @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event. + * @property {OpenSeadragon.MouseTracker} tracker - A reference to the MouseTracker which originated this event. + * @property {OpenSeadragon.Point} position - The position of the event relative to the tracked element. + * @property {String} pointerType - "mouse", "touch", "pen", etc. + * @property {Number} button - Button which caused the event. + * -1: none, 0: primary/left, 1: aux/middle, 2: secondary/right, 3: X1/back, 4: X2/forward, 5: pen eraser. + * @property {Number} buttons - Current buttons pressed. + * Combination of bit flags 0: none, 1: primary (or touch contact), 2: secondary, 4: aux (often middle), 8: X1 (often back), 16: X2 (often forward), 32: pen eraser. + * @property {Object} originalEvent - The original DOM event. + * @property {?Object} userData - Arbitrary subscriber-defined object. + */ + this.raiseEvent( 'canvas-aux-release', { + tracker: event.eventSource, + position: event.position, + pointerType: event.pointerType, + button: event.button, + buttons: event.buttons, + originalEvent: event.originalEvent + }); +} + function onCanvasPinch( event ) { var gestureSettings, centerPt, @@ -2593,7 +2651,7 @@ function onContainerRelease( event ) { } } /** - * Raised when the mouse button is released or touch ends on the {@link OpenSeadragon.Viewer#container} element. + * Raised when the primary mouse button is released or touch ends on the {@link OpenSeadragon.Viewer#container} element. * * @event container-release * @memberof OpenSeadragon.Viewer From ad838e7fd459a6d082d2cecb660648347e7b7a14 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Sat, 10 Jan 2015 14:51:56 -0800 Subject: [PATCH 02/11] changelog update --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index dfb1a5a9..2430d5f1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,7 +4,7 @@ OPENSEADRAGON CHANGELOG 1.2.1: (in progress) * Exposed secondary pointer button (middle, right, etc.) events from MouseTracker and through viewer (#479) -* MouseTracker - Improved IE 8 compatibility +* MouseTracker - Improved IE 8 compatibility (#562) 1.2.0: From becd11b6ceca46f1c048f3c7637150c01c7c8674 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Sun, 11 Jan 2015 10:06:07 -0800 Subject: [PATCH 03/11] Added unit tests --- test/events.js | 197 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 192 insertions(+), 5 deletions(-) diff --git a/test/events.js b/test/events.js index 07c14ea6..e9f5074f 100644 --- a/test/events.js +++ b/test/events.js @@ -35,6 +35,8 @@ origExitHandler, origPressHandler, origReleaseHandler, + origAuxPressHandler, + origAuxReleaseHandler, origMoveHandler, origClickHandler, origDblClickHandler, @@ -44,6 +46,10 @@ exitCount, pressCount, releaseCount, + rightPressCount, + rightReleaseCount, + auxPressCount, + auxReleaseCount, moveCount, clickCount, dblClickCount, @@ -94,6 +100,36 @@ return true; } }; + origAuxPressHandler = tracker.auxPressHandler; + tracker.auxPressHandler = function ( event ) { + if (event.button === 0) { + pressCount++; + } else if (event.button === 1) { + auxPressCount++; + } else if (event.button === 2) { + rightPressCount++; + } + if (origAuxPressHandler) { + return origAuxPressHandler( event ); + } else { + return true; + } + }; + origAuxReleaseHandler = tracker.auxReleaseHandler; + tracker.auxReleaseHandler = function ( event ) { + if (event.button === 0) { + releaseCount++; + } else if (event.button === 1) { + auxReleaseCount++; + } else if (event.button === 2) { + rightReleaseCount++; + } + if (origAuxReleaseHandler) { + return origAuxReleaseHandler( event ); + } else { + return true; + } + }; origMoveHandler = tracker.moveHandler; tracker.moveHandler = function ( event ) { moveCount++; @@ -176,12 +212,28 @@ }; var simulateDown = function (x, y) { + simEvent.button = 0; simEvent.clientX = offset.left + x; simEvent.clientY = offset.top + y; $canvas.simulate( 'mousedown', simEvent ); }; var simulateUp = function (x, y) { + simEvent.button = 0; + simEvent.clientX = offset.left + x; + simEvent.clientY = offset.top + y; + $canvas.simulate( 'mouseup', simEvent ); + }; + + var simulateAuxDown = function (x, y, button) { + simEvent.button = button; + simEvent.clientX = offset.left + x; + simEvent.clientY = offset.top + y; + $canvas.simulate( 'mousedown', simEvent ); + }; + + var simulateAuxUp = function (x, y, button) { + simEvent.button = button; simEvent.clientX = offset.left + x; simEvent.clientY = offset.top + y; $canvas.simulate( 'mouseup', simEvent ); @@ -198,6 +250,7 @@ var resetForAssessment = function () { simEvent = { + button: 0, clientX: offset.left, clientY: offset.top }; @@ -205,6 +258,10 @@ exitCount = 0; pressCount = 0; releaseCount = 0; + rightPressCount = 0; + rightReleaseCount = 0; + auxPressCount = 0; + auxReleaseCount = 0; moveCount = 0; clickCount = 0; dblClickCount = 0; @@ -231,6 +288,18 @@ if ('releaseCount' in expected) { equal( releaseCount, expected.releaseCount, expected.description + 'releaseHandler event count matches expected (' + expected.releaseCount + ')' ); } + if ('rightPressCount' in expected) { + equal( rightPressCount, expected.rightPressCount, expected.description + 'auxPressHandler event count (secondary/right button) matches expected (' + expected.rightPressCount + ')' ); + } + if ('rightReleaseCount' in expected) { + equal( rightReleaseCount, expected.rightReleaseCount, expected.description + 'auxReleaseHandler event count (secondary/right button) matches expected (' + expected.rightReleaseCount + ')' ); + } + if ('auxPressCount' in expected) { + equal( auxPressCount, expected.auxPressCount, expected.description + 'auxPressHandler event count (aux/middle button) matches expected (' + expected.auxPressCount + ')' ); + } + if ('auxReleaseCount' in expected) { + equal( auxReleaseCount, expected.auxReleaseCount, expected.description + 'auxReleaseHandler event count (aux/middle button) matches expected (' + expected.auxReleaseCount + ')' ); + } if ('moveCount' in expected) { equal( moveCount, expected.moveCount, expected.description + 'moveHandler event count matches expected (' + expected.moveCount + ')' ); } @@ -290,6 +359,10 @@ exitCount: 0, pressCount: 0, releaseCount: 1, + rightPressCount: 0, + rightReleaseCount: 0, + auxPressCount: 0, + auxReleaseCount: 0, moveCount: 20, clickCount: 0, dblClickCount: 0, @@ -315,6 +388,10 @@ exitCount: 1, pressCount: 0, releaseCount: 0, + rightPressCount: 0, + rightReleaseCount: 0, + auxPressCount: 0, + auxReleaseCount: 0, moveCount: 20, clickCount: 0, dblClickCount: 0, @@ -338,6 +415,10 @@ exitCount: 1, pressCount: 0, releaseCount: 0, + rightPressCount: 0, + rightReleaseCount: 0, + auxPressCount: 0, + auxReleaseCount: 0, moveCount: 20, clickCount: 0, dblClickCount: 0, @@ -350,7 +431,7 @@ //quickClick: false }); - // enter-press-release-press-release-exit (double click) + // enter-press-release-press-release-exit (primary/left double click) resetForAssessment(); simulateEnter(0, 0); simulateDown(0, 0); @@ -359,11 +440,15 @@ simulateUp(0, 0); simulateLeave(-1, -1); assessGestureExpectations({ - description: 'enter-press-release-press-release-exit (double click): ', + description: 'enter-press-release-press-release-exit (primary/left double click): ', enterCount: 1, exitCount: 1, pressCount: 2, releaseCount: 2, + rightPressCount: 0, + rightReleaseCount: 0, + auxPressCount: 0, + auxReleaseCount: 0, moveCount: 0, clickCount: 2, dblClickCount: 1, @@ -376,18 +461,22 @@ //quickClick: true }); - // enter-press-release-exit (click) + // enter-press-release-exit (primary/left click) resetForAssessment(); simulateEnter(0, 0); simulateDown(0, 0); simulateUp(0, 0); simulateLeave(-1, -1); assessGestureExpectations({ - description: 'enter-press-release-exit (click): ', + description: 'enter-press-release-exit (primary/left click): ', enterCount: 1, exitCount: 1, pressCount: 1, releaseCount: 1, + rightPressCount: 0, + rightReleaseCount: 0, + auxPressCount: 0, + auxReleaseCount: 0, moveCount: 0, clickCount: 1, dblClickCount: 0, @@ -400,6 +489,92 @@ quickClick: true }); + // enter-auxpress-auxrelease-exit (secondary/right click) + resetForAssessment(); + simulateEnter(0, 0); + simulateAuxDown(0, 0, 2); + simulateAuxUp(0, 0, 2); + simulateLeave(-1, -1); + assessGestureExpectations({ + description: 'enter-auxpress-auxrelease-exit (secondary/right click): ', + enterCount: 1, + exitCount: 1, + pressCount: 0, + releaseCount: 0, + rightPressCount: 1, + rightReleaseCount: 1, + auxPressCount: 0, + auxReleaseCount: 0, + moveCount: 0, + clickCount: 0, + dblClickCount: 0, + dragCount: 0, + dragEndCount: 0, + //insideElementPressed: true, + //insideElementReleased: true, + contacts: 0, + trackedPointers: 0, + //quickClick: true + }); + + // enter-auxpress-auxrelease-exit (aux/middle click) + resetForAssessment(); + simulateEnter(0, 0); + simulateAuxDown(0, 0, 1); + simulateAuxUp(0, 0, 1); + simulateLeave(-1, -1); + assessGestureExpectations({ + description: 'enter-auxpress-auxrelease-exit (aux/middle click): ', + enterCount: 1, + exitCount: 1, + pressCount: 0, + releaseCount: 0, + rightPressCount: 0, + rightReleaseCount: 0, + auxPressCount: 1, + auxReleaseCount: 1, + moveCount: 0, + clickCount: 0, + dblClickCount: 0, + dragCount: 0, + dragEndCount: 0, + //insideElementPressed: true, + //insideElementReleased: true, + contacts: 0, + trackedPointers: 0, + //quickClick: true + }); + + // enter-auxpress-move-auxrelease-move-exit (secondary/right button drag, release in tracked element) + resetForAssessment(); + simulateEnter(0, 0); + simulateAuxDown(0, 0, 2); + simulateMove(1, 1, 100); + simulateAuxUp(10, 10, 2); + simulateMove(-1, -1, 100); + simulateLeave(-1, -1); + assessGestureExpectations({ + description: 'enter-auxpress-move-auxrelease-move-exit (secondary/right button drag, release in tracked element): ', + enterCount: 1, + exitCount: 1, + pressCount: 0, + releaseCount: 0, + rightPressCount: 1, + rightReleaseCount: 1, + auxPressCount: 0, + auxReleaseCount: 0, + moveCount: 200, + clickCount: 0, + dblClickCount: 0, + dragCount: 0, + dragEndCount: 0, + //insideElementPressed: true, + //insideElementReleased: true, + contacts: 0, + trackedPointers: 0, + //quickClick: false + }); + // enter-press-move-release-move-exit (drag, release in tracked element) resetForAssessment(); simulateEnter(0, 0); @@ -414,6 +589,10 @@ exitCount: 1, pressCount: 1, releaseCount: 1, + rightPressCount: 0, + rightReleaseCount: 0, + auxPressCount: 0, + auxReleaseCount: 0, moveCount: 200, clickCount: 1, dblClickCount: 0, @@ -441,6 +620,10 @@ exitCount: 1, pressCount: 1, releaseCount: 1, + rightPressCount: 0, + rightReleaseCount: 0, + auxPressCount: 0, + auxReleaseCount: 0, moveCount: 15, clickCount: 0, dblClickCount: 0, @@ -453,7 +636,6 @@ quickClick: false }); - //// enter-press-move-exit-move-release-outside (drag, release outside iframe) //resetForAssessment(); //simulateEnter(0, 0); @@ -468,6 +650,10 @@ // exitCount: 1, // pressCount: 1, // releaseCount: 1, + // rightPressCount: 0, + // rightReleaseCount: 0, + // auxPressCount: 0, + // auxReleaseCount: 0, // moveCount: 10, // clickCount: 0, // dblClickCount: 0, @@ -479,6 +665,7 @@ // trackedPointers: 0, // quickClick: false //}); + unhookViewerHandlers(); viewer.close(); From 755854d3f7c7f35c0fabd0bcb9398adaaaacbcb8 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Mon, 12 Jan 2015 11:02:54 -0800 Subject: [PATCH 04/11] Renamed non-primary button events/handlers --- src/mousetracker.js | 54 ++++++++++----------- src/viewer.js | 40 +++++++-------- test/events.js | 116 ++++++++++++++++++++++---------------------- 3 files changed, 105 insertions(+), 105 deletions(-) diff --git a/src/mousetracker.js b/src/mousetracker.js index ff4f15fa..86e23f70 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -72,11 +72,11 @@ * An optional handler for pointer exit. * @param {OpenSeadragon.EventHandler} [options.pressHandler=null] * An optional handler for pointer press. - * @param {OpenSeadragon.EventHandler} [options.auxPressHandler=null] + * @param {OpenSeadragon.EventHandler} [options.nonPrimaryPressHandler=null] * An optional handler for pointer non-primary button press. * @param {OpenSeadragon.EventHandler} [options.releaseHandler=null] * An optional handler for pointer release. - * @param {OpenSeadragon.EventHandler} [options.auxReleaseHandler=null] + * @param {OpenSeadragon.EventHandler} [options.nonPrimaryReleaseHandler=null] * An optional handler for pointer non-primary button release. * @param {OpenSeadragon.EventHandler} [options.moveHandler=null] * An optional handler for pointer move. @@ -148,26 +148,26 @@ * @memberof OpenSeadragon.MouseTracker# */ this.dblClickDistThreshold = options.dblClickDistThreshold || $.DEFAULT_SETTINGS.dblClickDistThreshold; - this.userData = options.userData || null; - this.stopDelay = options.stopDelay || 50; + this.userData = options.userData || null; + this.stopDelay = options.stopDelay || 50; - this.enterHandler = options.enterHandler || null; - this.exitHandler = options.exitHandler || null; - this.pressHandler = options.pressHandler || null; - this.auxPressHandler = options.auxPressHandler || null; - this.releaseHandler = options.releaseHandler || null; - this.auxReleaseHandler = options.auxReleaseHandler || null; - this.moveHandler = options.moveHandler || null; - this.scrollHandler = options.scrollHandler || null; - this.clickHandler = options.clickHandler || null; - this.dblClickHandler = options.dblClickHandler || null; - this.dragHandler = options.dragHandler || null; - this.dragEndHandler = options.dragEndHandler || null; - this.pinchHandler = options.pinchHandler || null; - this.stopHandler = options.stopHandler || null; - this.keyHandler = options.keyHandler || null; - this.focusHandler = options.focusHandler || null; - this.blurHandler = options.blurHandler || null; + this.enterHandler = options.enterHandler || null; + this.exitHandler = options.exitHandler || null; + this.pressHandler = options.pressHandler || null; + this.nonPrimaryPressHandler = options.nonPrimaryPressHandler || null; + this.releaseHandler = options.releaseHandler || null; + this.nonPrimaryReleaseHandler = options.nonPrimaryReleaseHandler || null; + this.moveHandler = options.moveHandler || null; + this.scrollHandler = options.scrollHandler || null; + this.clickHandler = options.clickHandler || null; + this.dblClickHandler = options.dblClickHandler || null; + this.dragHandler = options.dragHandler || null; + this.dragEndHandler = options.dragEndHandler || null; + this.pinchHandler = options.pinchHandler || null; + this.stopHandler = options.stopHandler || null; + this.keyHandler = options.keyHandler || null; + this.focusHandler = options.focusHandler || null; + this.blurHandler = options.blurHandler || null; //Store private properties in a scope sealed hash map var _this = this; @@ -424,7 +424,7 @@ * @param {Object} event.userData * Arbitrary user-defined object. */ - auxPressHandler: function () { }, + nonPrimaryPressHandler: function () { }, /** * Implement or assign implementation to these handlers during or after @@ -482,7 +482,7 @@ * @param {Object} event.userData * Arbitrary user-defined object. */ - auxReleaseHandler: function () { }, + nonPrimaryReleaseHandler: function () { }, /** * Implement or assign implementation to these handlers during or after @@ -2494,8 +2494,8 @@ // Only capture and track primary button, pen, and touch contacts if ( buttonChanged !== 0 ) { // Aux Press - if ( tracker.auxPressHandler ) { - propagate = tracker.auxPressHandler( + if ( tracker.nonPrimaryPressHandler ) { + propagate = tracker.nonPrimaryPressHandler( { eventSource: tracker, pointerType: gPoints[ 0 ].type, @@ -2662,8 +2662,8 @@ // Only capture and track primary button, pen, and touch contacts if ( buttonChanged !== 0 ) { // Aux Release - if ( tracker.auxReleaseHandler ) { - propagate = tracker.auxReleaseHandler( + if ( tracker.nonPrimaryReleaseHandler ) { + propagate = tracker.nonPrimaryReleaseHandler( { eventSource: tracker, pointerType: gPoints[ 0 ].type, diff --git a/src/viewer.js b/src/viewer.js index 5c8b45a8..909e65b1 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -380,20 +380,20 @@ $.Viewer = function( options ) { this.innerTracker = new $.MouseTracker({ - element: this.canvas, - clickTimeThreshold: this.clickTimeThreshold, - clickDistThreshold: this.clickDistThreshold, - dblClickTimeThreshold: this.dblClickTimeThreshold, - dblClickDistThreshold: this.dblClickDistThreshold, - clickHandler: $.delegate( this, onCanvasClick ), - dblClickHandler: $.delegate( this, onCanvasDblClick ), - dragHandler: $.delegate( this, onCanvasDrag ), - dragEndHandler: $.delegate( this, onCanvasDragEnd ), - releaseHandler: $.delegate( this, onCanvasRelease ), - auxPressHandler: $.delegate( this, onCanvasAuxPress ), - auxReleaseHandler: $.delegate( this, onCanvasAuxRelease ), - scrollHandler: $.delegate( this, onCanvasScroll ), - pinchHandler: $.delegate( this, onCanvasPinch ) + element: this.canvas, + clickTimeThreshold: this.clickTimeThreshold, + clickDistThreshold: this.clickDistThreshold, + dblClickTimeThreshold: this.dblClickTimeThreshold, + dblClickDistThreshold: this.dblClickDistThreshold, + clickHandler: $.delegate( this, onCanvasClick ), + dblClickHandler: $.delegate( this, onCanvasDblClick ), + dragHandler: $.delegate( this, onCanvasDrag ), + dragEndHandler: $.delegate( this, onCanvasDragEnd ), + releaseHandler: $.delegate( this, onCanvasRelease ), + nonPrimaryPressHandler: $.delegate( this, onCanvasNonPrimaryPress ), + nonPrimaryReleaseHandler: $.delegate( this, onCanvasNonPrimaryRelease ), + scrollHandler: $.delegate( this, onCanvasScroll ), + pinchHandler: $.delegate( this, onCanvasPinch ) }).setTracking( this.mouseNavEnabled ? true : false ); // default state this.outerTracker = new $.MouseTracker({ @@ -2446,11 +2446,11 @@ function onCanvasRelease( event ) { }); } -function onCanvasAuxPress( event ) { +function onCanvasNonPrimaryPress( event ) { /** * Raised when any non-primary pointer button is pressed on the {@link OpenSeadragon.Viewer#canvas} element. * - * @event canvas-aux-press + * @event canvas-nonprimary-press * @memberof OpenSeadragon.Viewer * @type {object} * @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event. @@ -2464,7 +2464,7 @@ function onCanvasAuxPress( event ) { * @property {Object} originalEvent - The original DOM event. * @property {?Object} userData - Arbitrary subscriber-defined object. */ - this.raiseEvent( 'canvas-aux-press', { + this.raiseEvent( 'canvas-nonprimary-press', { tracker: event.eventSource, position: event.position, pointerType: event.pointerType, @@ -2474,11 +2474,11 @@ function onCanvasAuxPress( event ) { }); } -function onCanvasAuxRelease( event ) { +function onCanvasNonPrimaryRelease( event ) { /** * Raised when any non-primary pointer button is released on the {@link OpenSeadragon.Viewer#canvas} element. * - * @event canvas-aux-release + * @event canvas-nonprimary-release * @memberof OpenSeadragon.Viewer * @type {object} * @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event. @@ -2492,7 +2492,7 @@ function onCanvasAuxRelease( event ) { * @property {Object} originalEvent - The original DOM event. * @property {?Object} userData - Arbitrary subscriber-defined object. */ - this.raiseEvent( 'canvas-aux-release', { + this.raiseEvent( 'canvas-nonprimary-release', { tracker: event.eventSource, position: event.position, pointerType: event.pointerType, diff --git a/test/events.js b/test/events.js index e9f5074f..43069e96 100644 --- a/test/events.js +++ b/test/events.js @@ -35,8 +35,8 @@ origExitHandler, origPressHandler, origReleaseHandler, - origAuxPressHandler, - origAuxReleaseHandler, + origNonPrimaryPressHandler, + origNonPrimaryReleaseHandler, origMoveHandler, origClickHandler, origDblClickHandler, @@ -48,8 +48,8 @@ releaseCount, rightPressCount, rightReleaseCount, - auxPressCount, - auxReleaseCount, + middlePressCount, + middleReleaseCount, moveCount, clickCount, dblClickCount, @@ -100,32 +100,32 @@ return true; } }; - origAuxPressHandler = tracker.auxPressHandler; - tracker.auxPressHandler = function ( event ) { + origNonPrimaryPressHandler = tracker.nonPrimaryPressHandler; + tracker.nonPrimaryPressHandler = function ( event ) { if (event.button === 0) { pressCount++; } else if (event.button === 1) { - auxPressCount++; + middlePressCount++; } else if (event.button === 2) { rightPressCount++; } - if (origAuxPressHandler) { - return origAuxPressHandler( event ); + if (origNonPrimaryPressHandler) { + return origNonPrimaryPressHandler( event ); } else { return true; } }; - origAuxReleaseHandler = tracker.auxReleaseHandler; - tracker.auxReleaseHandler = function ( event ) { + origNonPrimaryReleaseHandler = tracker.nonPrimaryReleaseHandler; + tracker.nonPrimaryReleaseHandler = function ( event ) { if (event.button === 0) { releaseCount++; } else if (event.button === 1) { - auxReleaseCount++; + middleReleaseCount++; } else if (event.button === 2) { rightReleaseCount++; } - if (origAuxReleaseHandler) { - return origAuxReleaseHandler( event ); + if (origNonPrimaryReleaseHandler) { + return origNonPrimaryReleaseHandler( event ); } else { return true; } @@ -225,14 +225,14 @@ $canvas.simulate( 'mouseup', simEvent ); }; - var simulateAuxDown = function (x, y, button) { + var simulateNonPrimaryDown = function (x, y, button) { simEvent.button = button; simEvent.clientX = offset.left + x; simEvent.clientY = offset.top + y; $canvas.simulate( 'mousedown', simEvent ); }; - var simulateAuxUp = function (x, y, button) { + var simulateNonPrimaryUp = function (x, y, button) { simEvent.button = button; simEvent.clientX = offset.left + x; simEvent.clientY = offset.top + y; @@ -260,8 +260,8 @@ releaseCount = 0; rightPressCount = 0; rightReleaseCount = 0; - auxPressCount = 0; - auxReleaseCount = 0; + middlePressCount = 0; + middleReleaseCount = 0; moveCount = 0; clickCount = 0; dblClickCount = 0; @@ -289,16 +289,16 @@ equal( releaseCount, expected.releaseCount, expected.description + 'releaseHandler event count matches expected (' + expected.releaseCount + ')' ); } if ('rightPressCount' in expected) { - equal( rightPressCount, expected.rightPressCount, expected.description + 'auxPressHandler event count (secondary/right button) matches expected (' + expected.rightPressCount + ')' ); + equal( rightPressCount, expected.rightPressCount, expected.description + 'nonPrimaryPressHandler event count (secondary/right button) matches expected (' + expected.rightPressCount + ')' ); } if ('rightReleaseCount' in expected) { - equal( rightReleaseCount, expected.rightReleaseCount, expected.description + 'auxReleaseHandler event count (secondary/right button) matches expected (' + expected.rightReleaseCount + ')' ); + equal( rightReleaseCount, expected.rightReleaseCount, expected.description + 'nonPrimaryReleaseHandler event count (secondary/right button) matches expected (' + expected.rightReleaseCount + ')' ); } - if ('auxPressCount' in expected) { - equal( auxPressCount, expected.auxPressCount, expected.description + 'auxPressHandler event count (aux/middle button) matches expected (' + expected.auxPressCount + ')' ); + if ('middlePressCount' in expected) { + equal( middlePressCount, expected.middlePressCount, expected.description + 'nonPrimaryPressHandler event count (aux/middle button) matches expected (' + expected.middlePressCount + ')' ); } - if ('auxReleaseCount' in expected) { - equal( auxReleaseCount, expected.auxReleaseCount, expected.description + 'auxReleaseHandler event count (aux/middle button) matches expected (' + expected.auxReleaseCount + ')' ); + if ('middleReleaseCount' in expected) { + equal( middleReleaseCount, expected.middleReleaseCount, expected.description + 'nonPrimaryReleaseHandler event count (aux/middle button) matches expected (' + expected.middleReleaseCount + ')' ); } if ('moveCount' in expected) { equal( moveCount, expected.moveCount, expected.description + 'moveHandler event count matches expected (' + expected.moveCount + ')' ); @@ -361,8 +361,8 @@ releaseCount: 1, rightPressCount: 0, rightReleaseCount: 0, - auxPressCount: 0, - auxReleaseCount: 0, + middlePressCount: 0, + middleReleaseCount: 0, moveCount: 20, clickCount: 0, dblClickCount: 0, @@ -390,8 +390,8 @@ releaseCount: 0, rightPressCount: 0, rightReleaseCount: 0, - auxPressCount: 0, - auxReleaseCount: 0, + middlePressCount: 0, + middleReleaseCount: 0, moveCount: 20, clickCount: 0, dblClickCount: 0, @@ -417,8 +417,8 @@ releaseCount: 0, rightPressCount: 0, rightReleaseCount: 0, - auxPressCount: 0, - auxReleaseCount: 0, + middlePressCount: 0, + middleReleaseCount: 0, moveCount: 20, clickCount: 0, dblClickCount: 0, @@ -447,8 +447,8 @@ releaseCount: 2, rightPressCount: 0, rightReleaseCount: 0, - auxPressCount: 0, - auxReleaseCount: 0, + middlePressCount: 0, + middleReleaseCount: 0, moveCount: 0, clickCount: 2, dblClickCount: 1, @@ -475,8 +475,8 @@ releaseCount: 1, rightPressCount: 0, rightReleaseCount: 0, - auxPressCount: 0, - auxReleaseCount: 0, + middlePressCount: 0, + middleReleaseCount: 0, moveCount: 0, clickCount: 1, dblClickCount: 0, @@ -489,22 +489,22 @@ quickClick: true }); - // enter-auxpress-auxrelease-exit (secondary/right click) + // enter-nonprimarypress-nonprimaryrelease-exit (secondary/right click) resetForAssessment(); simulateEnter(0, 0); - simulateAuxDown(0, 0, 2); - simulateAuxUp(0, 0, 2); + simulateNonPrimaryDown(0, 0, 2); + simulateNonPrimaryUp(0, 0, 2); simulateLeave(-1, -1); assessGestureExpectations({ - description: 'enter-auxpress-auxrelease-exit (secondary/right click): ', + description: 'enter-nonprimarypress-nonprimaryrelease-exit (secondary/right click): ', enterCount: 1, exitCount: 1, pressCount: 0, releaseCount: 0, rightPressCount: 1, rightReleaseCount: 1, - auxPressCount: 0, - auxReleaseCount: 0, + middlePressCount: 0, + middleReleaseCount: 0, moveCount: 0, clickCount: 0, dblClickCount: 0, @@ -517,22 +517,22 @@ //quickClick: true }); - // enter-auxpress-auxrelease-exit (aux/middle click) + // enter-nonprimarypress-nonprimaryrelease-exit (aux/middle click) resetForAssessment(); simulateEnter(0, 0); - simulateAuxDown(0, 0, 1); - simulateAuxUp(0, 0, 1); + simulateNonPrimaryDown(0, 0, 1); + simulateNonPrimaryUp(0, 0, 1); simulateLeave(-1, -1); assessGestureExpectations({ - description: 'enter-auxpress-auxrelease-exit (aux/middle click): ', + description: 'enter-nonprimarypress-nonprimaryrelease-exit (aux/middle click): ', enterCount: 1, exitCount: 1, pressCount: 0, releaseCount: 0, rightPressCount: 0, rightReleaseCount: 0, - auxPressCount: 1, - auxReleaseCount: 1, + middlePressCount: 1, + middleReleaseCount: 1, moveCount: 0, clickCount: 0, dblClickCount: 0, @@ -545,24 +545,24 @@ //quickClick: true }); - // enter-auxpress-move-auxrelease-move-exit (secondary/right button drag, release in tracked element) + // enter-nonprimarypress-move-nonprimaryrelease-move-exit (secondary/right button drag, release in tracked element) resetForAssessment(); simulateEnter(0, 0); - simulateAuxDown(0, 0, 2); + simulateNonPrimaryDown(0, 0, 2); simulateMove(1, 1, 100); - simulateAuxUp(10, 10, 2); + simulateNonPrimaryUp(10, 10, 2); simulateMove(-1, -1, 100); simulateLeave(-1, -1); assessGestureExpectations({ - description: 'enter-auxpress-move-auxrelease-move-exit (secondary/right button drag, release in tracked element): ', + description: 'enter-nonprimarypress-move-nonprimaryrelease-move-exit (secondary/right button drag, release in tracked element): ', enterCount: 1, exitCount: 1, pressCount: 0, releaseCount: 0, rightPressCount: 1, rightReleaseCount: 1, - auxPressCount: 0, - auxReleaseCount: 0, + middlePressCount: 0, + middleReleaseCount: 0, moveCount: 200, clickCount: 0, dblClickCount: 0, @@ -591,8 +591,8 @@ releaseCount: 1, rightPressCount: 0, rightReleaseCount: 0, - auxPressCount: 0, - auxReleaseCount: 0, + middlePressCount: 0, + middleReleaseCount: 0, moveCount: 200, clickCount: 1, dblClickCount: 0, @@ -622,8 +622,8 @@ releaseCount: 1, rightPressCount: 0, rightReleaseCount: 0, - auxPressCount: 0, - auxReleaseCount: 0, + middlePressCount: 0, + middleReleaseCount: 0, moveCount: 15, clickCount: 0, dblClickCount: 0, @@ -652,8 +652,8 @@ // releaseCount: 1, // rightPressCount: 0, // rightReleaseCount: 0, - // auxPressCount: 0, - // auxReleaseCount: 0, + // middlePressCount: 0, + // middleReleaseCount: 0, // moveCount: 10, // clickCount: 0, // dblClickCount: 0, From d582a9563f80b3352b4259df881aad049d009c45 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Mon, 12 Jan 2015 12:26:38 -0800 Subject: [PATCH 05/11] capturePointer()/releasePointer() call fix for pointer event model --- src/mousetracker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mousetracker.js b/src/mousetracker.js index 86e23f70..d1722b16 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -2104,7 +2104,7 @@ if ( updatePointersDown( tracker, event, [ gPoint ], event.button ) ) { $.stopEvent( event ); - capturePointer( tracker, 'pointer' ); + capturePointer( tracker, gPoint.type ); } if ( tracker.clickHandler || tracker.dblClickHandler || tracker.pressHandler || tracker.dragHandler || tracker.dragEndHandler || tracker.pinchHandler ) { @@ -2154,7 +2154,7 @@ }; if ( updatePointersUp( tracker, event, [ gPoint ], event.button ) ) { - releasePointer( tracker, 'pointer' ); + releasePointer( tracker, gPoint.type ); } } From 1bdb83dc583889582c23d7276659143bdaf41fee Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Mon, 12 Jan 2015 12:56:18 -0800 Subject: [PATCH 06/11] Second attempt: capturePointer()/releasePointer() call fix for pointer event model --- src/mousetracker.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/mousetracker.js b/src/mousetracker.js index d1722b16..d566f54a 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -1250,17 +1250,17 @@ * @private * @inner */ - function capturePointer( tracker, pointerType ) { + function capturePointer( tracker, pointerType, isPointerEventModel ) { var pointsList = tracker.getActivePointersListByType( pointerType ), eventParams; pointsList.captureCount++; if ( pointsList.captureCount === 1 ) { - if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { + if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 10 ) { tracker.element.setCapture( true ); } else { - eventParams = getCaptureEventParams( tracker, pointerType ); + eventParams = getCaptureEventParams( tracker, tracker, isPointerEventModel ? 'pointerevent' : pointerType ); // We emulate mouse capture by hanging listeners on the document object. // (Note we listen on the capture phase so the captured handlers will get called first) $.addEvent( @@ -1285,17 +1285,17 @@ * @private * @inner */ - function releasePointer( tracker, pointerType ) { + function releasePointer( tracker, pointerType, isPointerEventModel ) { var pointsList = tracker.getActivePointersListByType( pointerType ), eventParams; pointsList.captureCount--; if ( pointsList.captureCount === 0 ) { - if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { + if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 10 ) { tracker.element.releaseCapture(); } else { - eventParams = getCaptureEventParams( tracker, pointerType ); + eventParams = getCaptureEventParams( tracker, isPointerEventModel ? 'pointerevent' : pointerType ); // We emulate mouse capture by hanging listeners on the document object. // (Note we listen on the capture phase so the captured handlers will get called first) $.removeEvent( @@ -1718,7 +1718,7 @@ if ( updatePointersDown( tracker, event, [ gPoint ], getStandardizedButton( event.button ) ) ) { $.stopEvent( event ); - capturePointer( tracker, 'mouse' ); + capturePointer( tracker, 'mouse', false ); } if ( tracker.clickHandler || tracker.dblClickHandler || tracker.pressHandler || tracker.dragHandler || tracker.dragEndHandler ) { @@ -1766,7 +1766,7 @@ }; if ( updatePointersUp( tracker, event, [ gPoint ], getStandardizedButton( event.button ) ) ) { - releasePointer( tracker, 'mouse' ); + releasePointer( tracker, 'mouse', false ); } } @@ -1889,7 +1889,7 @@ if ( updatePointersDown( tracker, event, gPoints, 0 ) ) { // 0 means primary button press/release or touch contact $.stopEvent( event ); - capturePointer( tracker, 'touch' ); + capturePointer( tracker, 'touch', false ); } $.cancelEvent( event ); @@ -1941,7 +1941,7 @@ } if ( updatePointersUp( tracker, event, gPoints, 0 ) ) { - releasePointer( tracker, 'touch' ); + releasePointer( tracker, 'touch', false ); } // simulate touchleave if not natively available @@ -2104,7 +2104,7 @@ if ( updatePointersDown( tracker, event, [ gPoint ], event.button ) ) { $.stopEvent( event ); - capturePointer( tracker, gPoint.type ); + capturePointer( tracker, gPoint.type, true ); } if ( tracker.clickHandler || tracker.dblClickHandler || tracker.pressHandler || tracker.dragHandler || tracker.dragEndHandler || tracker.pinchHandler ) { @@ -2154,7 +2154,7 @@ }; if ( updatePointersUp( tracker, event, [ gPoint ], event.button ) ) { - releasePointer( tracker, gPoint.type ); + releasePointer( tracker, gPoint.type, true ); } } From 1c465ec59c13920c56c3a4655dc75af619174989 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Mon, 12 Jan 2015 15:33:18 -0800 Subject: [PATCH 07/11] Revert "Second attempt: capturePointer()/releasePointer() call fix for pointer event model" This reverts commit 1bdb83dc583889582c23d7276659143bdaf41fee. --- src/mousetracker.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/mousetracker.js b/src/mousetracker.js index d566f54a..d1722b16 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -1250,17 +1250,17 @@ * @private * @inner */ - function capturePointer( tracker, pointerType, isPointerEventModel ) { + function capturePointer( tracker, pointerType ) { var pointsList = tracker.getActivePointersListByType( pointerType ), eventParams; pointsList.captureCount++; if ( pointsList.captureCount === 1 ) { - if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 10 ) { + if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { tracker.element.setCapture( true ); } else { - eventParams = getCaptureEventParams( tracker, tracker, isPointerEventModel ? 'pointerevent' : pointerType ); + eventParams = getCaptureEventParams( tracker, pointerType ); // We emulate mouse capture by hanging listeners on the document object. // (Note we listen on the capture phase so the captured handlers will get called first) $.addEvent( @@ -1285,17 +1285,17 @@ * @private * @inner */ - function releasePointer( tracker, pointerType, isPointerEventModel ) { + function releasePointer( tracker, pointerType ) { var pointsList = tracker.getActivePointersListByType( pointerType ), eventParams; pointsList.captureCount--; if ( pointsList.captureCount === 0 ) { - if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 10 ) { + if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { tracker.element.releaseCapture(); } else { - eventParams = getCaptureEventParams( tracker, isPointerEventModel ? 'pointerevent' : pointerType ); + eventParams = getCaptureEventParams( tracker, pointerType ); // We emulate mouse capture by hanging listeners on the document object. // (Note we listen on the capture phase so the captured handlers will get called first) $.removeEvent( @@ -1718,7 +1718,7 @@ if ( updatePointersDown( tracker, event, [ gPoint ], getStandardizedButton( event.button ) ) ) { $.stopEvent( event ); - capturePointer( tracker, 'mouse', false ); + capturePointer( tracker, 'mouse' ); } if ( tracker.clickHandler || tracker.dblClickHandler || tracker.pressHandler || tracker.dragHandler || tracker.dragEndHandler ) { @@ -1766,7 +1766,7 @@ }; if ( updatePointersUp( tracker, event, [ gPoint ], getStandardizedButton( event.button ) ) ) { - releasePointer( tracker, 'mouse', false ); + releasePointer( tracker, 'mouse' ); } } @@ -1889,7 +1889,7 @@ if ( updatePointersDown( tracker, event, gPoints, 0 ) ) { // 0 means primary button press/release or touch contact $.stopEvent( event ); - capturePointer( tracker, 'touch', false ); + capturePointer( tracker, 'touch' ); } $.cancelEvent( event ); @@ -1941,7 +1941,7 @@ } if ( updatePointersUp( tracker, event, gPoints, 0 ) ) { - releasePointer( tracker, 'touch', false ); + releasePointer( tracker, 'touch' ); } // simulate touchleave if not natively available @@ -2104,7 +2104,7 @@ if ( updatePointersDown( tracker, event, [ gPoint ], event.button ) ) { $.stopEvent( event ); - capturePointer( tracker, gPoint.type, true ); + capturePointer( tracker, gPoint.type ); } if ( tracker.clickHandler || tracker.dblClickHandler || tracker.pressHandler || tracker.dragHandler || tracker.dragEndHandler || tracker.pinchHandler ) { @@ -2154,7 +2154,7 @@ }; if ( updatePointersUp( tracker, event, [ gPoint ], event.button ) ) { - releasePointer( tracker, gPoint.type, true ); + releasePointer( tracker, gPoint.type ); } } From 83ff3651216717e36a220936f98dc11866709813 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Mon, 12 Jan 2015 15:33:51 -0800 Subject: [PATCH 08/11] Revert "capturePointer()/releasePointer() call fix for pointer event model" This reverts commit d582a9563f80b3352b4259df881aad049d009c45. --- src/mousetracker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mousetracker.js b/src/mousetracker.js index d1722b16..86e23f70 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -2104,7 +2104,7 @@ if ( updatePointersDown( tracker, event, [ gPoint ], event.button ) ) { $.stopEvent( event ); - capturePointer( tracker, gPoint.type ); + capturePointer( tracker, 'pointer' ); } if ( tracker.clickHandler || tracker.dblClickHandler || tracker.pressHandler || tracker.dragHandler || tracker.dragEndHandler || tracker.pinchHandler ) { @@ -2154,7 +2154,7 @@ }; if ( updatePointersUp( tracker, event, [ gPoint ], event.button ) ) { - releasePointer( tracker, gPoint.type ); + releasePointer( tracker, 'pointer' ); } } From 0d6fca35c114e620d40252df7ad0fb9c46444fc5 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Mon, 12 Jan 2015 16:08:26 -0800 Subject: [PATCH 09/11] Fix pointer type passed to capturePointer/releasePointer in pointer events model. Remembered to change the test shim as well. --- src/mousetracker.js | 27 ++++++++++++++++----------- test/legacy.mouse.shim.js | 12 ++++++++++-- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/mousetracker.js b/src/mousetracker.js index 86e23f70..09b3c751 100644 --- a/src/mousetracker.js +++ b/src/mousetracker.js @@ -880,6 +880,7 @@ if ( window.PointerEvent ) { // IE11 and other W3C Pointer Event implementations (see http://www.w3.org/TR/pointerevents) + $.MouseTracker.havePointerEvents = true; $.MouseTracker.subscribeEvents.push( "pointerover", "pointerout", "pointerdown", "pointerup", "pointermove", "pointercancel" ); $.MouseTracker.unprefixedPointerEvents = true; if( navigator.maxTouchPoints ) { @@ -891,6 +892,7 @@ $.MouseTracker.haveMouseEnter = false; } else if ( window.MSPointerEvent ) { // IE10 + $.MouseTracker.havePointerEvents = true; $.MouseTracker.subscribeEvents.push( "MSPointerOver", "MSPointerOut", "MSPointerDown", "MSPointerUp", "MSPointerMove", "MSPointerCancel" ); $.MouseTracker.unprefixedPointerEvents = false; if( navigator.msMaxTouchPoints ) { @@ -902,6 +904,7 @@ $.MouseTracker.haveMouseEnter = false; } else { // Legacy W3C mouse events + $.MouseTracker.havePointerEvents = false; if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { $.MouseTracker.subscribeEvents.push( "mouseenter", "mouseleave" ); $.MouseTracker.haveMouseEnter = true; @@ -1221,7 +1224,14 @@ function getCaptureEventParams( tracker, pointerType ) { var delegate = THIS[ tracker.hash ]; - if ( pointerType === 'mouse' ) { + if ( pointerType === 'pointerevent' ) { + return { + upName: $.MouseTracker.unprefixedPointerEvents ? 'pointerup' : 'MSPointerUp', + upHandler: delegate.pointerupcaptured, + moveName: $.MouseTracker.unprefixedPointerEvents ? 'pointermove' : 'MSPointerMove', + moveHandler: delegate.pointermovecaptured + }; + } else if ( pointerType === 'mouse' ) { return { upName: 'mouseup', upHandler: delegate.mouseupcaptured, @@ -1236,12 +1246,7 @@ moveHandler: delegate.touchmovecaptured }; } else { - return { - upName: $.MouseTracker.unprefixedPointerEvents ? 'pointerup' : 'MSPointerUp', - upHandler: delegate.pointerupcaptured, - moveName: $.MouseTracker.unprefixedPointerEvents ? 'pointermove' : 'MSPointerMove', - moveHandler: delegate.pointermovecaptured - }; + throw new Error( "MouseTracker.getCaptureEventParams: Unknown pointer type." ); } } @@ -1260,7 +1265,7 @@ if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { tracker.element.setCapture( true ); } else { - eventParams = getCaptureEventParams( tracker, pointerType ); + eventParams = getCaptureEventParams( tracker, $.MouseTracker.havePointerEvents ? 'pointerevent' : pointerType ); // We emulate mouse capture by hanging listeners on the document object. // (Note we listen on the capture phase so the captured handlers will get called first) $.addEvent( @@ -1295,7 +1300,7 @@ if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { tracker.element.releaseCapture(); } else { - eventParams = getCaptureEventParams( tracker, pointerType ); + eventParams = getCaptureEventParams( tracker, $.MouseTracker.havePointerEvents ? 'pointerevent' : pointerType ); // We emulate mouse capture by hanging listeners on the document object. // (Note we listen on the capture phase so the captured handlers will get called first) $.removeEvent( @@ -2104,7 +2109,7 @@ if ( updatePointersDown( tracker, event, [ gPoint ], event.button ) ) { $.stopEvent( event ); - capturePointer( tracker, 'pointer' ); + capturePointer( tracker, gPoint.type ); } if ( tracker.clickHandler || tracker.dblClickHandler || tracker.pressHandler || tracker.dragHandler || tracker.dragEndHandler || tracker.pinchHandler ) { @@ -2154,7 +2159,7 @@ }; if ( updatePointersUp( tracker, event, [ gPoint ], event.button ) ) { - releasePointer( tracker, 'pointer' ); + releasePointer( tracker, gPoint.type ); } } diff --git a/test/legacy.mouse.shim.js b/test/legacy.mouse.shim.js index 7a8ff7cc..535f8815 100644 --- a/test/legacy.mouse.shim.js +++ b/test/legacy.mouse.shim.js @@ -11,8 +11,15 @@ $.MouseTracker.subscribeEvents.push( "MozMousePixelScroll" ); } - $.MouseTracker.subscribeEvents.push( "mouseover", "mouseout", "mousedown", "mouseup", "mousemove" ); - $.MouseTracker.haveMouseEnter = false; + $.MouseTracker.havePointerEvents = false; + if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) { + $.MouseTracker.subscribeEvents.push( "mouseenter", "mouseleave" ); + $.MouseTracker.haveMouseEnter = true; + } else { + $.MouseTracker.subscribeEvents.push( "mouseover", "mouseout" ); + $.MouseTracker.haveMouseEnter = false; + } + $.MouseTracker.subscribeEvents.push( "mousedown", "mouseup", "mousemove" ); if ( 'ontouchstart' in window ) { // iOS, Android, and other W3c Touch Event implementations (see http://www.w3.org/TR/2011/WD-touch-events-20110505) $.MouseTracker.subscribeEvents.push( "touchstart", "touchend", "touchmove", "touchcancel" ); @@ -33,4 +40,5 @@ $.MouseTracker.mousePointerId = "legacy-mouse"; $.MouseTracker.maxTouchPoints = 10; + }(OpenSeadragon)); From cc1b6b7c6ff05467e76ba0c774ae557cd34f0ac5 Mon Sep 17 00:00:00 2001 From: Mark Salsbery Date: Tue, 13 Jan 2015 08:41:02 -0800 Subject: [PATCH 10/11] Minor events.js test comment fix --- test/events.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/events.js b/test/events.js index 43069e96..5f850082 100644 --- a/test/events.js +++ b/test/events.js @@ -201,15 +201,16 @@ var simulateLeave = function (x, y) { simEvent.clientX = offset.left + x; simEvent.clientY = offset.top + y; - // simEvent.relatedTarget = document.body; - // $canvas.simulate( OpenSeadragon.MouseTracker.haveMouseEnter ? 'mouseleave' : 'mouseout', simEvent ); - //}; + simEvent.relatedTarget = document.body; + $canvas.simulate( OpenSeadragon.MouseTracker.haveMouseEnter ? 'mouseleave' : 'mouseout', simEvent ); + }; + //var simulateLeaveFrame = function (x, y) { // simEvent.clientX = offset.left + x; // simEvent.clientY = offset.top + y; // simEvent.relatedTarget = document.getElementsByTagName("html")[0]; - $canvas.simulate( OpenSeadragon.MouseTracker.haveMouseEnter ? 'mouseleave' : 'mouseout', simEvent ); - }; + // $canvas.simulate( OpenSeadragon.MouseTracker.haveMouseEnter ? 'mouseleave' : 'mouseout', simEvent ); + //}; var simulateDown = function (x, y) { simEvent.button = 0; From aa735c1e001213db999e63d1a7fe5c599603c9f4 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 13 Jan 2015 09:27:39 -0800 Subject: [PATCH 11/11] Changelog fix --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 0bff9545..04986505 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,7 +4,7 @@ OPENSEADRAGON CHANGELOG 1.2.1: (in progress) * Added preserveOverlays option (#561) -* Fixed: DZI tilesource was broken (#563) +* Fixed: DZI tilesource was broken on IE8/IE9 (#563) * Exposed secondary pointer button (middle, right, etc.) events from MouseTracker and through viewer (#479) * MouseTracker - Improved IE 8 compatibility (#562)