mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Removed mousenter/mouseleave DOM Event Handling
Fixes #394 mouseenter/mouseleave are not implemented in Webkit very well, so reverted to mouseover/mouseout.
This commit is contained in:
parent
2ab984aa38
commit
5b995eb04b
@ -174,8 +174,6 @@
|
|||||||
* Are we curruently capturing mouse events (legacy mouse events only).
|
* Are we curruently capturing mouse events (legacy mouse events only).
|
||||||
*/
|
*/
|
||||||
THIS[ this.hash ] = {
|
THIS[ this.hash ] = {
|
||||||
setCaptureCapable: !!this.element.setCapture && !!this.element.releaseCapture,
|
|
||||||
|
|
||||||
click: function ( event ) { onClick( _this, event ); },
|
click: function ( event ) { onClick( _this, event ); },
|
||||||
dblclick: function ( event ) { onDblClick( _this, event ); },
|
dblclick: function ( event ) { onDblClick( _this, event ); },
|
||||||
keypress: function ( event ) { onKeyPress( _this, event ); },
|
keypress: function ( event ) { onKeyPress( _this, event ); },
|
||||||
@ -795,6 +793,14 @@
|
|||||||
document.onmousewheel !== undefined ? 'mousewheel' : // Webkit and IE support at least 'mousewheel'
|
document.onmousewheel !== undefined ? 'mousewheel' : // Webkit and IE support at least 'mousewheel'
|
||||||
'DOMMouseScroll'; // Assume old Firefox
|
'DOMMouseScroll'; // Assume old Firefox
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect legacy mouse capture support.
|
||||||
|
*/
|
||||||
|
$.MouseTracker.supportsMouseCapture = (function () {
|
||||||
|
var divElement = document.createElement( 'div' );
|
||||||
|
return $.isFunction( divElement.setCapture ) && $.isFunction( divElement.releaseCapture );
|
||||||
|
}());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect browser pointer device event model(s) and build appropriate list of events to subscribe to.
|
* Detect browser pointer device event model(s) and build appropriate list of events to subscribe to.
|
||||||
*/
|
*/
|
||||||
@ -829,14 +835,9 @@
|
|||||||
$.MouseTracker.haveMouseEnter = true;
|
$.MouseTracker.haveMouseEnter = true;
|
||||||
} else {
|
} else {
|
||||||
// Legacy W3C mouse events
|
// Legacy W3C mouse events
|
||||||
$.MouseTracker.subscribeEvents.push( "mousedown", "mouseup", "mousemove" );
|
// TODO: Favor mouseenter/mouseleave over mouseover/mouseout when Webkit browser support is better
|
||||||
if ( 'onmouseenter' in window ) {
|
$.MouseTracker.subscribeEvents.push( "mouseover", "mouseout", "mousedown", "mouseup", "mousemove" );
|
||||||
$.MouseTracker.subscribeEvents.push( "mouseenter", "mouseleave" );
|
|
||||||
$.MouseTracker.haveMouseEnter = true;
|
|
||||||
} else {
|
|
||||||
$.MouseTracker.subscribeEvents.push( "mouseover", "mouseout" );
|
|
||||||
$.MouseTracker.haveMouseEnter = false;
|
$.MouseTracker.haveMouseEnter = false;
|
||||||
}
|
|
||||||
if ( 'ontouchstart' in window ) {
|
if ( 'ontouchstart' in window ) {
|
||||||
// iOS, Android, and other W3c Touch Event implementations (see http://www.w3.org/TR/2011/WD-touch-events-20110505)
|
// 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" );
|
$.MouseTracker.subscribeEvents.push( "touchstart", "touchend", "touchmove", "touchcancel" );
|
||||||
@ -1082,7 +1083,7 @@
|
|||||||
var delegate = THIS[ tracker.hash ];
|
var delegate = THIS[ tracker.hash ];
|
||||||
|
|
||||||
if ( !delegate.capturing ) {
|
if ( !delegate.capturing ) {
|
||||||
if ( delegate.setCaptureCapable ) {
|
if ( $.MouseTracker.supportsMouseCapture ) {
|
||||||
// IE<10, Firefox, other browsers with setCapture()/releaseCapture()
|
// IE<10, Firefox, other browsers with setCapture()/releaseCapture()
|
||||||
tracker.element.setCapture( true );
|
tracker.element.setCapture( true );
|
||||||
} else {
|
} else {
|
||||||
@ -1115,7 +1116,7 @@
|
|||||||
var delegate = THIS[ tracker.hash ];
|
var delegate = THIS[ tracker.hash ];
|
||||||
|
|
||||||
if ( delegate.capturing ) {
|
if ( delegate.capturing ) {
|
||||||
if ( delegate.setCaptureCapable ) {
|
if ( $.MouseTracker.supportsMouseCapture ) {
|
||||||
// IE<10, Firefox, other browsers with setCapture()/releaseCapture()
|
// IE<10, Firefox, other browsers with setCapture()/releaseCapture()
|
||||||
tracker.element.releaseCapture();
|
tracker.element.releaseCapture();
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user