mirror of
https://github.com/tobspr-games/shapez.io.git
synced 2026-01-16 06:10:58 -08:00
remove moving on min/max zoom
This commit is contained in:
parent
785f20c35f
commit
35f427da82
1 changed files with 3 additions and 1 deletions
|
|
@ -500,6 +500,7 @@ export class Camera extends BasicSerializableObject {
|
|||
event.preventDefault();
|
||||
// event.stopPropagation();
|
||||
}
|
||||
const prevZoom = this.zoomLevel;
|
||||
|
||||
const delta = Math.sign(event.deltaY) * -0.15 * this.root.app.settings.getScrollWheelSensitivity();
|
||||
assert(Number.isFinite(delta), "Got invalid delta in mouse wheel event: " + event.deltaY);
|
||||
|
|
@ -515,7 +516,8 @@ export class Camera extends BasicSerializableObject {
|
|||
const worldPos = this.root.camera.screenToWorld(mousePosition);
|
||||
let de = worldPos.sub(this.center);
|
||||
this.desiredCenter = null;
|
||||
this.center = this.center.add(de.multiplyScalar(delta));
|
||||
const actualDelta = this.zoomLevel / prevZoom - 1;
|
||||
this.center = this.center.add(de.multiplyScalar(actualDelta));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue