adjusted zoom to fit ratio

This commit is contained in:
Ladd 2025-12-31 20:01:48 -06:00
parent 106707d6b2
commit f53a82f594
3 changed files with 26 additions and 3 deletions

1
.ladd Normal file
View File

@ -0,0 +1 @@
Hi :P

23
Layout.md Normal file
View File

@ -0,0 +1,23 @@
Overlay > Info Box
Each toolbar gives itself a header tool which expands/collapses the toolbar.
- Toolbar Group: Left Side
- Toolbar: Tools
- Tool: Zoom
- Toolbar: Modes
- Tool: Mode Switch
- Toolbar: Utils
- Tool: Utility Tool
- Toolbar Group: Right Side
- Toolbar: Options
- Tool: Options Tool
- Section: Pause During
- Section: Display
- Section: Collision
- Toolbar: Params
- Tool: Options Tool
- Section: Param
- Toolbar: Debug
- Tool: Options Tool
- Section: Debug

View File

@ -60,9 +60,8 @@ export class Zoom extends Tool {
const y = (box.start.y + box.end.y) / 2;
const widthRatio = Math.abs(box.start.x - box.end.x) / this.sim.display.width;
const heightRatio = Math.abs(box.start.y - box.end.y) / this.sim.display.height;
const biggerRatio = Math.max(widthRatio, heightRatio);
const base2factor = Math.log2(1 / biggerRatio) - 1;
const factor = Math.ceil(base2factor);
const ratio = Math.max(widthRatio, heightRatio) * 2.5;
const factor = Math.ceil(Math.log2(1 / ratio));
// Determine average momentum and set panning velocity to match
const { netMomentum, totalMass } = this.sim.system.computeSystemCenter();