Browse Source

Fix touch input issue on Chrome for Android (fixes #551).

tags/2.4.1
Matthew Petroff 6 years ago
parent
commit
2031720700
2 changed files with 13 additions and 8 deletions
  1. +1
    -0
      src/css/pannellum.css
  2. +12
    -8
      src/js/pannellum.js

+ 1
- 0
src/css/pannellum.css View File

@@ -17,6 +17,7 @@
outline: 0; outline: 0;
line-height: 1.4; line-height: 1.4;
contain: content; contain: content;
touch-action: none;
} }


.pnlm-container * { .pnlm-container * {


+ 12
- 8
src/js/pannellum.js View File

@@ -482,13 +482,17 @@ function onImageLoad() {
container.addEventListener('blur', clearKeys, false); container.addEventListener('blur', clearKeys, false);
} }
document.addEventListener('mouseleave', onDocumentMouseUp, false); document.addEventListener('mouseleave', onDocumentMouseUp, false);
dragFix.addEventListener('touchstart', onDocumentTouchStart, false);
dragFix.addEventListener('touchmove', onDocumentTouchMove, false);
dragFix.addEventListener('touchend', onDocumentTouchEnd, false);
dragFix.addEventListener('pointerdown', onDocumentPointerDown, false);
dragFix.addEventListener('pointermove', onDocumentPointerMove, false);
dragFix.addEventListener('pointerup', onDocumentPointerUp, false);
dragFix.addEventListener('pointerleave', onDocumentPointerUp, false);
if (document.documentElement.style.pointerAction === '' &&
document.documentElement.style.touchAction === '') {
dragFix.addEventListener('pointerdown', onDocumentPointerDown, false);
dragFix.addEventListener('pointermove', onDocumentPointerMove, false);
dragFix.addEventListener('pointerup', onDocumentPointerUp, false);
dragFix.addEventListener('pointerleave', onDocumentPointerUp, false);
} else {
dragFix.addEventListener('touchstart', onDocumentTouchStart, false);
dragFix.addEventListener('touchmove', onDocumentTouchMove, false);
dragFix.addEventListener('touchend', onDocumentTouchEnd, false);
}


// Deal with MS pointer events // Deal with MS pointer events
if (window.navigator.pointerEnabled) if (window.navigator.pointerEnabled)
@@ -928,7 +932,7 @@ function onDocumentPointerMove(event) {
pointerCoordinates[i].clientY = event.clientY; pointerCoordinates[i].clientY = event.clientY;
event.targetTouches = pointerCoordinates; event.targetTouches = pointerCoordinates;
onDocumentTouchMove(event); onDocumentTouchMove(event);
//event.preventDefault();
event.preventDefault();
return; return;
} }
} }


Loading…
Cancel
Save