Skip to content

Commit

Permalink
hopefully fix 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 5583b99 commit b2f4311
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,10 +408,11 @@
} 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 d = Math.sqrt(dx * dx + dy * dy);
const dZoom = (d - Math.sqrt(touchPrevX * touchPrevX + touchPrevY * touchPrevY)) * 0.01;
camZoom = touchStartCamZoom + dZoom;
clampZoom();
const dist = Math.sqrt(dx * dx + dy * dy);
const dZoom = (dist - Math.sqrt(touchPrevX * touchPrevX + touchPrevY * touchPrevY)) / 100;
touchPrevX = dx;
touchPrevY = dy;
zoomMap(dZoom);
}
event.preventDefault();
});
Expand Down

0 comments on commit b2f4311

Please sign in to comment.