mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-28 16:16:08 +03:00
cb56e352cf
1) MouseTracker - Simulated touchenter/touchleave events now bubble to parent element MouseTrackers 2) MouseTracker - Improved multitouch support in enter/exit event handlers 3) MouseTracker - orphaned tracked touch pointers removed (fix for #539) 4) MouseTracker - removed touchenter/touchleave event support since the events don't exist on any known platform and have been removed from the W3C specification 5) Removed Viewer onContainerPress/onContainerRelease handlers (and the associated 'container-release' event ) that were never fired due to the canvas (child) element capturing the DOM events 6) Added 'canvas-enter', 'canvas-exit', and 'canvas-press' events to Viewer 7) ButtonGroup - removed obsolete MouseTracker event handlers
40 lines
1.9 KiB
JavaScript
40 lines
1.9 KiB
JavaScript
(function($, undefined) {
|
|
|
|
/**
|
|
* Plugin to force OpenSeadragon to use the legacy mouse pointer event model
|
|
*/
|
|
|
|
$.MouseTracker.subscribeEvents = [ "click", "dblclick", "keypress", "focus", "blur", $.MouseTracker.wheelEventName ];
|
|
|
|
if( $.MouseTracker.wheelEventName == "DOMMouseScroll" ) {
|
|
// Older Firefox
|
|
$.MouseTracker.subscribeEvents.push( "MozMousePixelScroll" );
|
|
}
|
|
|
|
$.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/touch-events/)
|
|
// (see https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html)
|
|
// (see https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html)
|
|
$.MouseTracker.subscribeEvents.push( "touchstart", "touchend", "touchmove", "touchcancel" );
|
|
}
|
|
if ( 'ongesturestart' in window ) {
|
|
// iOS (see https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html)
|
|
// Subscribe to these to prevent default gesture handling
|
|
$.MouseTracker.subscribeEvents.push( "gesturestart", "gesturechange" );
|
|
}
|
|
$.MouseTracker.mousePointerId = "legacy-mouse";
|
|
$.MouseTracker.maxTouchPoints = 10;
|
|
|
|
|
|
}(OpenSeadragon));
|