make canvas dragging a bit snappier by calculating the drag delta ourselves

I'm really thankful for `listen` here.
it makes this sort of logic super easy without having to add class fields.
This commit is contained in:
りき萌 2024-09-03 22:52:12 +02:00
parent bfbde0dee3
commit 740a62447e
2 changed files with 8 additions and 6 deletions

View file

@ -9,11 +9,6 @@ export class Viewport {
return Math.pow(2, this.zoomLevel * 0.25);
}
panAround(x, y) {
this.panX -= x / this.zoom;
this.panY -= y / this.zoom;
}
zoomIn(delta) {
this.zoomLevel += delta;
this.zoomLevel = Math.max(-16, Math.min(20, this.zoomLevel));