Lashtw commited on
Commit
9c0a211
·
verified ·
1 Parent(s): 64b672e

Upload algebra.html

Browse files
Files changed (1) hide show
  1. algebra.html +8 -1
algebra.html CHANGED
@@ -512,12 +512,19 @@
512
  }
513
 
514
  function getPointer(e) {
 
 
 
 
 
515
  if (e.touches && e.touches.length > 0) {
516
  return { x: e.touches[0].clientX, y: e.touches[0].clientY };
517
  }
 
518
  return { x: e.clientX, y: e.clientY };
519
  }
520
 
 
521
  function moveClone(x, y) {
522
  if (!clone) return;
523
  clone.style.left = `${x - offset.x}px`;
@@ -568,4 +575,4 @@
568
  </script>
569
 
570
  </body>
571
- </html>
 
512
  }
513
 
514
  function getPointer(e) {
515
+ // For touchend event, we need to use changedTouches because touches is empty.
516
+ if (e.changedTouches && e.changedTouches.length > 0) {
517
+ return { x: e.changedTouches[0].clientX, y: e.changedTouches[0].clientY };
518
+ }
519
+ // For touchstart and touchmove events.
520
  if (e.touches && e.touches.length > 0) {
521
  return { x: e.touches[0].clientX, y: e.touches[0].clientY };
522
  }
523
+ // Fallback for mouse events.
524
  return { x: e.clientX, y: e.clientY };
525
  }
526
 
527
+
528
  function moveClone(x, y) {
529
  if (!clone) return;
530
  clone.style.left = `${x - offset.x}px`;
 
575
  </script>
576
 
577
  </body>
578
+ </html>