Merge pull request #1861 from JoePfeiffer/fix-1857

Remove bounds on minimum and maximum zoom sizes
This commit is contained in:
Sibo Van Gool 2022-12-01 01:47:19 +01:00 committed by GitHub
commit 4ccfa3c8d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View File

@ -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();

View File

@ -19,9 +19,6 @@ import net.sf.openrocket.util.StateChangeListener;
@SuppressWarnings("serial")
public class ScaleSelector {
public static final double MINIMUM_ZOOM = 0.01; // == 1 %
public static final double MAXIMUM_ZOOM = 1000.00; // == 10,000 %
// Ready zoom settings
private static final DecimalFormat PERCENT_FORMAT = new DecimalFormat("0.#%");