mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-26 07:06:10 +03:00
Handle simultaneous touch events
Found and tested on an iPhone 5s w/ iOS 9.2. Not sure about other devices. Fixes #877
This commit is contained in:
parent
6099962e40
commit
a4dbae0754
@ -1357,11 +1357,11 @@
|
|||||||
* @private
|
* @private
|
||||||
* @inner
|
* @inner
|
||||||
*/
|
*/
|
||||||
function capturePointer( tracker, pointerType ) {
|
function capturePointer( tracker, pointerType, touchCount ) {
|
||||||
var pointsList = tracker.getActivePointersListByType( pointerType ),
|
var pointsList = tracker.getActivePointersListByType( pointerType ),
|
||||||
eventParams;
|
eventParams;
|
||||||
|
|
||||||
pointsList.captureCount++;
|
pointsList.captureCount += (pointerType === 'touch' ? touchCount : 1);
|
||||||
|
|
||||||
if ( pointsList.captureCount === 1 ) {
|
if ( pointsList.captureCount === 1 ) {
|
||||||
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) {
|
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) {
|
||||||
@ -1400,11 +1400,11 @@
|
|||||||
* @private
|
* @private
|
||||||
* @inner
|
* @inner
|
||||||
*/
|
*/
|
||||||
function releasePointer( tracker, pointerType ) {
|
function releasePointer( tracker, pointerType, touchCount ) {
|
||||||
var pointsList = tracker.getActivePointersListByType( pointerType ),
|
var pointsList = tracker.getActivePointersListByType( pointerType ),
|
||||||
eventParams;
|
eventParams;
|
||||||
|
|
||||||
pointsList.captureCount--;
|
pointsList.captureCount -= (pointerType === 'touch' ? touchCount : 1);
|
||||||
|
|
||||||
if ( pointsList.captureCount === 0 ) {
|
if ( pointsList.captureCount === 0 ) {
|
||||||
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) {
|
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) {
|
||||||
@ -2074,7 +2074,7 @@
|
|||||||
|
|
||||||
if ( updatePointersDown( tracker, event, gPoints, 0 ) ) { // 0 means primary button press/release or touch contact
|
if ( updatePointersDown( tracker, event, gPoints, 0 ) ) { // 0 means primary button press/release or touch contact
|
||||||
$.stopEvent( event );
|
$.stopEvent( event );
|
||||||
capturePointer( tracker, 'touch' );
|
capturePointer( tracker, 'touch', touchCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
$.cancelEvent( event );
|
$.cancelEvent( event );
|
||||||
@ -2128,7 +2128,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( updatePointersUp( tracker, event, gPoints, 0 ) ) {
|
if ( updatePointersUp( tracker, event, gPoints, 0 ) ) {
|
||||||
releasePointer( tracker, 'touch' );
|
releasePointer( tracker, 'touch', touchCount );
|
||||||
}
|
}
|
||||||
|
|
||||||
// simulate touchleave on our tracked element
|
// simulate touchleave on our tracked element
|
||||||
|
Loading…
Reference in New Issue
Block a user