mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
remove moving on min/max zoom
This commit is contained in:
parent
785f20c35f
commit
35f427da82
@ -500,6 +500,7 @@ export class Camera extends BasicSerializableObject {
|
|||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
// event.stopPropagation();
|
// event.stopPropagation();
|
||||||
}
|
}
|
||||||
|
const prevZoom = this.zoomLevel;
|
||||||
|
|
||||||
const delta = Math.sign(event.deltaY) * -0.15 * this.root.app.settings.getScrollWheelSensitivity();
|
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);
|
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);
|
const worldPos = this.root.camera.screenToWorld(mousePosition);
|
||||||
let de = worldPos.sub(this.center);
|
let de = worldPos.sub(this.center);
|
||||||
this.desiredCenter = null;
|
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;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user