mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Merge branch 'master' into symmetric-piece-generator
This commit is contained in:
commit
ecb8381c93
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 17 KiB |
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4846f685f3e242444706e1f295347f6c6205984edff75ddf32fbb5a7d497c598
|
||||
size 215617
|
||||
oid sha256:ff5ce5977b343577cc189f1e32cf16e6ecd36e8c97be40877199d546fdbeae17
|
||||
size 211969
|
||||
|
@ -10,7 +10,7 @@ export const CHANGELOG = [
|
||||
"Added keybinding to close menus (by isaisstillalive / Sandwichs-del)",
|
||||
"Fix rare crash regarding the buildings toolbar (by isaisstillalive)",
|
||||
"Fixed some phrases (By EnderDoom77)",
|
||||
|
||||
"Zoom towards mouse cursor (by Dimava)",
|
||||
"Updated the soundtrack again, it is now 20 minutes in total!",
|
||||
"Updated and added new translations (Thanks to all contributors!)",
|
||||
],
|
||||
|
@ -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);
|
||||
@ -509,6 +510,16 @@ export class Camera extends BasicSerializableObject {
|
||||
|
||||
this.clampZoomLevel();
|
||||
this.desiredZoom = null;
|
||||
|
||||
const mousePosition = this.root.app.mousePosition;
|
||||
if (mousePosition) {
|
||||
const worldPos = this.root.camera.screenToWorld(mousePosition);
|
||||
const worldDelta = worldPos.sub(this.center);
|
||||
const actualDelta = this.zoomLevel / prevZoom - 1;
|
||||
this.center = this.center.add(worldDelta.multiplyScalar(actualDelta));
|
||||
this.desiredCenter = null;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user