Sfoglia il codice sorgente

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

tags/2.4.1
Matthew Petroff 6 anni fa
parent
commit
2031720700
2 ha cambiato i file con 13 aggiunte e 8 eliminazioni
  1. +1
    -0
      src/css/pannellum.css
  2. +12
    -8
      src/js/pannellum.js

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

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

.pnlm-container * {


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

@@ -482,13 +482,17 @@ function onImageLoad() {
container.addEventListener('blur', clearKeys, 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
if (window.navigator.pointerEnabled)
@@ -928,7 +932,7 @@ function onDocumentPointerMove(event) {
pointerCoordinates[i].clientY = event.clientY;
event.targetTouches = pointerCoordinates;
onDocumentTouchMove(event);
//event.preventDefault();
event.preventDefault();
return;
}
}


Caricamento…
Annulla
Salva