Skip to content

Commit

Permalink
trying stuff with the touch zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
Not-A-Normal-Robot committed Jan 27, 2024
1 parent b2f4311 commit 94508ab
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@
} else if(event.touches.length === 2) {
const dx = event.touches[0].clientX - event.touches[1].clientX;
const dy = event.touches[0].clientY - event.touches[1].clientY;
const dist = Math.sqrt(dx * dx + dy * dy);
const dZoom = (dist - Math.sqrt(touchPrevX * touchPrevX + touchPrevY * touchPrevY)) / 100;
const dist = dx * dx + dy * dy;
const dZoom = (dist - touchPrevX * touchPrevX + touchPrevY * touchPrevY) / 100;
touchPrevX = dx;
touchPrevY = dy;
zoomMap(dZoom);
Expand All @@ -420,6 +420,9 @@
if(event.touches.length === 0) {
touchPrevX = 0;
touchPrevY = 0;
} else if(event.touches.length === 1) {
touchPrevX = event.touches[0].clientX;
touchPrevY = event.touches[0].clientY;
}
});
}
Expand Down

0 comments on commit 94508ab

Please sign in to comment.