mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 05:06:09 +03:00
Updated implementation to better pass tests, still not 100% though.
This commit is contained in:
parent
7278793e5c
commit
f07108ec2d
@ -193,7 +193,7 @@
|
||||
mousemove: function ( event ) { onMouseMove( _this, event ); },
|
||||
mousemovecaptured: function ( event ) { onMouseMoveCaptured( _this, event ); },
|
||||
|
||||
mouseoutdocument: function ( event ) { onMouseUp( _this, event ); },
|
||||
mouseoutdocument: function ( event ) { onMouseOutDocument( _this, event ); },
|
||||
|
||||
touchenter: function ( event ) { onTouchEnter( _this, event ); },
|
||||
touchleave: function ( event ) { onTouchLeave( _this, event ); },
|
||||
@ -1053,7 +1053,7 @@
|
||||
}
|
||||
|
||||
// handle mouse out of document area
|
||||
$.addEvent(document, "mouseout", delegate.mouseoutdocument);
|
||||
$.addEvent(document.body, "mouseout", delegate.mouseoutdocument);
|
||||
|
||||
delegate.tracking = true;
|
||||
}
|
||||
@ -1081,7 +1081,7 @@
|
||||
}
|
||||
|
||||
// handle mouse out of document area
|
||||
$.removeEvent(document, "mouseout", delegate.mouseoutdocument);
|
||||
$.removeEvent(document.body, "mouseout", delegate.mouseoutdocument);
|
||||
|
||||
delegate.tracking = false;
|
||||
}
|
||||
@ -1537,6 +1537,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
function onMouseOutDocument( tracker, event ) {
|
||||
event = $.getEvent( event );
|
||||
|
||||
var html = document.getElementsByTagName("html")[0];
|
||||
if ((event.relatedTarget!==html && event.relatedTarget!==null) || event.currentTarget !== document.body) {
|
||||
return; // not a mouseout of the iframe
|
||||
}
|
||||
event.buttons = undefined;
|
||||
event.button = 0;
|
||||
handleMouseUp(tracker,event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
@ -165,6 +165,13 @@
|
||||
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 );
|
||||
};
|
||||
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 );
|
||||
};
|
||||
|
||||
@ -446,6 +453,33 @@
|
||||
quickClick: false
|
||||
});
|
||||
|
||||
|
||||
// enter-press-move-exit-move-release (drag, release outside tracked element)
|
||||
resetForAssessment();
|
||||
simulateEnter(0, 0);
|
||||
simulateDown(0, 0);
|
||||
simulateMove(1, 1, 5);
|
||||
simulateMove(105, 105, 5);
|
||||
simulateLeaveFrame(105, 105);
|
||||
simulateMove(105, 105, 5);
|
||||
// you don't actually receive the mouseup if you mouseup outside of the document
|
||||
assessGestureExpectations({
|
||||
description: 'enter-press-move-exit-move-release-outside (drag, release outside iframe): ',
|
||||
enterCount: 1,
|
||||
exitCount: 1,
|
||||
pressCount: 1,
|
||||
releaseCount: 1,
|
||||
moveCount: 15,
|
||||
clickCount: 0,
|
||||
dblClickCount: 0,
|
||||
dragCount: 10,
|
||||
dragEndCount: 1,
|
||||
insideElementPressed: true,
|
||||
insideElementReleased: false,
|
||||
contacts: 0,
|
||||
trackedPointers: 0,
|
||||
quickClick: false
|
||||
});
|
||||
unhookViewerHandlers();
|
||||
|
||||
viewer.close();
|
||||
|
Loading…
Reference in New Issue
Block a user