Skip to content

Commit 2babb66

Browse files
committed
re-adding touch events, adding variants of user-select: none
1 parent a3a2546 commit 2babb66

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

index.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
align-items: center;
1414
background-color: #ffffff;
1515
font-family: Arial, Helvetica, sans-serif;
16+
-webkit-touch-callout: none;
1617
-webkit-user-select: none;
18+
-khtml-user-select: none;
19+
-moz-user-select: none;
20+
-ms-user-select: none;
1721
user-select: none;
1822
}
1923

@@ -218,10 +222,16 @@
218222
let lastThumbPosition = { x: 150, y: 50 };
219223
const needleLength = 75; // Constant length for the needle
220224
let entity = null; // apptive entitiy
221-
// Pointer event listeners
222-
thumb.addEventListener('pointerdown', startDrag);
223-
document.addEventListener('pointermove', onDrag);
224-
document.addEventListener('pointerup', endDrag);
225+
226+
// Desktop Event
227+
thumb.addEventListener('mousedown', startDrag);
228+
document.addEventListener('mousemove', onDrag);
229+
document.addEventListener('mouseup', endDrag);
230+
231+
// Mobile event listeners
232+
thumb.addEventListener('touchstart', startDrag);
233+
document.addEventListener('touchmove', onDrag);
234+
document.addEventListener('touchend', endDrag);
225235

226236
function startDrag(e) {
227237
e.preventDefault();

0 commit comments

Comments
 (0)