fixed zoom to fit

This commit is contained in:
Ladd 2025-12-27 12:01:50 -06:00
parent 1e3efe5150
commit 4f1dfae696
2 changed files with 3 additions and 3 deletions

View File

@ -193,7 +193,8 @@ export class Display {
ctx.fill();
// Draw arrow for the velocity
if (this.sim.getOption('show.velocity')) {
if (this.sim.getOption('display.velocity')) {
console.log('velocity vector');
const speed = Math.sqrt(vx ** 2 + vy ** 2);
const endVx = x + VELOCITY_VECTOR_SCALE * vx / speed * Math.log(speed);
const endVy = y + VELOCITY_VECTOR_SCALE * vy / speed * Math.log(speed);
@ -209,7 +210,7 @@ export class Display {
}
// Draw arrow for acceleration
if (this.sim.getOption('show.acceleration')) {
if (this.sim.getOption('display.acceleration')) {
const accelerationMagnitude = Math.sqrt(acceleration.x ** 2 + acceleration.y ** 2);
const endAx = x + ACCELERATION_VECTOR_SCALE * acceleration.x /
accelerationMagnitude * Math.log(accelerationMagnitude);

View File

@ -49,7 +49,6 @@ export class Zoom extends Tool {
const biggerRatio = Math.max(widthRatio, heightRatio);
const base2factor = Math.log(1/biggerRatio) / Math.log(2);
const factor = Math.floor(base2factor) - 1;
console.log({biggerRatio, base2factor, factor});
this.sim.scheduleZoom({x, y}, factor);
}
});