mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Wheel zoom saves world mouse position
This commit is contained in:
@@ -509,6 +509,14 @@ export class Camera extends BasicSerializableObject {
|
|||||||
|
|
||||||
this.clampZoomLevel();
|
this.clampZoomLevel();
|
||||||
this.desiredZoom = null;
|
this.desiredZoom = null;
|
||||||
|
|
||||||
|
const mousePosition = this.root.app.mousePosition;
|
||||||
|
if (mousePosition) {
|
||||||
|
const worldPos = this.root.camera.screenToWorld(mousePosition);
|
||||||
|
let de = worldPos.sub(this.center);
|
||||||
|
this.center = this.center.add(de.multiplyScalar(delta));
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user