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
if ( $ . MouseTracker . wheelEventName == "DOMMouseScroll" ) {
// Older Firefox
$ . MouseTracker . subscribeEvents . push ( "MozMousePixelScroll" ) ;
}
2014-04-16 00:04:08 +04:00
$ . MouseTracker . subscribeEvents . push ( "mousedown" , "mouseup" , "mousemove" ) ;
if ( 'onmouseenter' in window ) {
$ . MouseTracker . subscribeEvents . push ( "mouseenter" , "mouseleave" ) ;
$ . MouseTracker . haveMouseEnter = true ;
} else {
$ . MouseTracker . subscribeEvents . push ( "mouseover" , "mouseout" ) ;
$ . MouseTracker . haveMouseEnter = false ;
}
2014-03-31 23:54:37 +04:00
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" ) ;
if ( 'ontouchenter' in window ) {
$ . MouseTracker . subscribeEvents . push ( "touchenter" , "touchleave" ) ;
$ . MouseTracker . haveTouchEnter = true ;
2014-04-15 05:17:18 +04:00
} else {
2014-03-31 23:54:37 +04:00
$ . MouseTracker . haveTouchEnter = false ;
}
2014-04-15 05:17:18 +04:00
} else {
$ . MouseTracker . haveTouchEnter = false ;
2014-03-31 23:54:37 +04:00
}
if ( 'ongesturestart' in window ) {
// iOS (see https://developer.apple.com/library/safari/documentation/UserExperience/Reference/GestureEventClassReference/GestureEvent/GestureEvent.html)
// Subscribe to these to prevent default gesture handling
$ . MouseTracker . subscribeEvents . push ( "gesturestart" , "gesturechange" ) ;
}
$ . MouseTracker . mousePointerId = "legacy-mouse" ;
$ . MouseTracker . maxTouchPoints = 10 ;
} ( OpenSeadragon ) ) ;