Skip to content

Commit

Permalink
Using device agnostic pointer events
Browse files Browse the repository at this point in the history
  • Loading branch information
gmeral committed Oct 1, 2024
1 parent 021c4d5 commit f544b04
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,10 @@
let lastThumbPosition = { x: 150, y: 50 };
const needleLength = 75; // Constant length for the needle
let entity = null; // apptive entitiy
// Desktop event listeners
thumb.addEventListener('mousedown', startDrag);
document.addEventListener('mousemove', onDrag);
document.addEventListener('mouseup', endDrag);

// Mobile event listeners
thumb.addEventListener('touchstart', startDrag);
document.addEventListener('touchmove', onDrag);
document.addEventListener('touchend', endDrag);
// Pointer event listeners
thumb.addEventListener('pointerdown', startDrag);
document.addEventListener('pointermove', onDrag);
document.addEventListener('pointerup', endDrag);

function startDrag(e) {
if (typeof pollyMessageListener !== 'undefined' && pollyMessageListener !== null) {
Expand Down

0 comments on commit f544b04

Please sign in to comment.