From 50e14410088e70ff0923a1cc2cef63a77d329f12 Mon Sep 17 00:00:00 2001 From: JoePfeiffer Date: Wed, 30 Nov 2022 17:30:24 -0700 Subject: [PATCH] Remove bounds limit on rocket figure scaling Note the sanity checks (scale must be greater than 0, etc) are still present Make epsilon in check of new vs. old scale factor depend on old scale factor so setting new scale can still work with tiny scales. --- .../openrocket/gui/scalefigure/AbstractScaleFigure.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/scalefigure/AbstractScaleFigure.java b/swing/src/net/sf/openrocket/gui/scalefigure/AbstractScaleFigure.java index ebeb76ebb..492c5c483 100644 --- a/swing/src/net/sf/openrocket/gui/scalefigure/AbstractScaleFigure.java +++ b/swing/src/net/sf/openrocket/gui/scalefigure/AbstractScaleFigure.java @@ -27,9 +27,6 @@ public abstract class AbstractScaleFigure extends JPanel { public static final double INCHES_PER_METER = 39.3701; public static final double METERS_PER_INCH = 0.0254; - public static final double MINIMUM_ZOOM = 0.01; // == 1 % - public static final double MAXIMUM_ZOOM = 1000.00; // == 10,000 % - // Number of pixels to leave at edges when fitting figure private static final int DEFAULT_BORDER_PIXELS_WIDTH = 30; private static final int DEFAULT_BORDER_PIXELS_HEIGHT = 20; @@ -113,7 +110,7 @@ public abstract class AbstractScaleFigure extends JPanel { * @return true if the scale changed, false if it was already at the requested scale or something went wrong. */ public boolean scaleTo(final double newScaleRequest, final Dimension newVisibleBounds) { - if (MathUtil.equals(this.userScale, newScaleRequest, 0.01) && + if (MathUtil.equals(this.userScale, newScaleRequest, newScaleRequest * 0.01) && (visibleBounds_px.width == newVisibleBounds.width) && (visibleBounds_px.height == newVisibleBounds.height) ) { return false; @@ -122,7 +119,8 @@ public abstract class AbstractScaleFigure extends JPanel { return false; } - this.userScale = MathUtil.clamp( newScaleRequest, MINIMUM_ZOOM, MAXIMUM_ZOOM); + this.userScale = newScaleRequest; + this.scale = baseScale * userScale; updateCanvasOrigin();