Merge pull request #1861 from JoePfeiffer/fix-1857
Remove bounds on minimum and maximum zoom sizes
This commit is contained in:
commit
4ccfa3c8d4
@ -27,9 +27,6 @@ public abstract class AbstractScaleFigure extends JPanel {
|
|||||||
public static final double INCHES_PER_METER = 39.3701;
|
public static final double INCHES_PER_METER = 39.3701;
|
||||||
public static final double METERS_PER_INCH = 0.0254;
|
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
|
// 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_WIDTH = 30;
|
||||||
private static final int DEFAULT_BORDER_PIXELS_HEIGHT = 20;
|
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.
|
* @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) {
|
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.width == newVisibleBounds.width) &&
|
||||||
(visibleBounds_px.height == newVisibleBounds.height) ) {
|
(visibleBounds_px.height == newVisibleBounds.height) ) {
|
||||||
return false;
|
return false;
|
||||||
@ -122,7 +119,8 @@ public abstract class AbstractScaleFigure extends JPanel {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.userScale = MathUtil.clamp( newScaleRequest, MINIMUM_ZOOM, MAXIMUM_ZOOM);
|
this.userScale = newScaleRequest;
|
||||||
|
|
||||||
this.scale = baseScale * userScale;
|
this.scale = baseScale * userScale;
|
||||||
updateCanvasOrigin();
|
updateCanvasOrigin();
|
||||||
|
|
||||||
|
@ -18,9 +18,6 @@ import net.sf.openrocket.util.StateChangeListener;
|
|||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class ScaleSelector {
|
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
|
// Ready zoom settings
|
||||||
private static final DecimalFormat PERCENT_FORMAT = new DecimalFormat("0.#%");
|
private static final DecimalFormat PERCENT_FORMAT = new DecimalFormat("0.#%");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user