mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Wheel zoom saves world mouse position
This commit is contained in:
parent
f0a75a8255
commit
2f6b3afbab
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user