2014-03-31 23:54:37 +04:00
|
|
|
(function($, undefined) {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Plugin to force OpenSeadragon to use the legacy mouse pointer event model
|
|
|
|
*/
|
|
|
|
|
2014-04-22 20:23:56 +04:00
|
|
|
$.MouseTracker.subscribeEvents = [ "click", "dblclick", "keypress", "focus", "blur", $.MouseTracker.wheelEventName ];
|
2014-03-31 23:54:37 +04:00
|
|
|
|
2021-03-09 00:33:05 +03:00
|
|
|
if( $.MouseTracker.wheelEventName === "DOMMouseScroll" ) {
|
2014-03-31 23:54:37 +04:00
|
|
|
// Older Firefox
|
|
|
|
$.MouseTracker.subscribeEvents.push( "MozMousePixelScroll" );
|
|
|
|
}
|
|
|
|
|
2015-01-13 03:08:26 +03:00
|
|
|
$.MouseTracker.havePointerEvents = false;
|
2021-03-09 00:33:05 +03:00
|
|
|
$.MouseTracker.subscribeEvents.push( "mouseenter", "mouseleave", "mouseover", "mouseout", "mousedown", "mouseup", "mousemove" );
|
2020-08-14 05:56:22 +03:00
|
|
|
$.MouseTracker.mousePointerId = "legacy-mouse";
|
|
|
|
// Legacy mouse events capture support (IE/Firefox only?)
|
|
|
|
$.MouseTracker.havePointerCapture = (function () {
|
|
|
|
var divElement = document.createElement( 'div' );
|
|
|
|
return $.isFunction( divElement.setCapture ) && $.isFunction( divElement.releaseCapture );
|
|
|
|
}());
|
|
|
|
if ( $.MouseTracker.havePointerCapture ) {
|
|
|
|
$.MouseTracker.subscribeEvents.push( "losecapture" );
|
|
|
|
}
|
2014-03-31 23:54:37 +04:00
|
|
|
if ( 'ontouchstart' in window ) {
|
2015-01-15 23:15:22 +03:00
|
|
|
// 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)
|
2014-03-31 23:54:37 +04:00
|
|
|
$.MouseTracker.subscribeEvents.push( "touchstart", "touchend", "touchmove", "touchcancel" );
|
|
|
|
}
|
|
|
|
if ( 'ongesturestart' in window ) {
|
2015-01-15 23:15:22 +03:00
|
|
|
// iOS (see https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html)
|
2014-03-31 23:54:37 +04:00
|
|
|
// Subscribe to these to prevent default gesture handling
|
|
|
|
$.MouseTracker.subscribeEvents.push( "gesturestart", "gesturechange" );
|
|
|
|
}
|
2015-01-13 03:08:26 +03:00
|
|
|
|
2014-03-31 23:54:37 +04:00
|
|
|
}(OpenSeadragon));
|