Increase the range of zoom slider for images to 500%

This commit is contained in:
Branislav Stojkovic
2019-02-28 17:36:04 +01:00
parent 2c689c584d
commit 595cfb3ed1
3 changed files with 16 additions and 7 deletions
@@ -57,7 +57,7 @@ public class Image extends AbstractTransparentComponent<Void> {
private static final long serialVersionUID = 1L;
public static String DEFAULT_TEXT = "Double click to edit text";
private static ImageIcon ICON;
private static byte DEFAULT_SCALE = 50;
private static byte DEFAULT_SCALE = 25;
static {
String name = "image.png";
@@ -78,7 +78,8 @@ public class Image extends AbstractTransparentComponent<Void> {
@Deprecated
private ImageIcon image;
private byte[] data;
private byte scale = DEFAULT_SCALE;
private Byte scale;
private byte newScale = DEFAULT_SCALE;
public Image() {
try {
@@ -91,7 +92,7 @@ public class Image extends AbstractTransparentComponent<Void> {
@Override
public void draw(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
IDrawingObserver drawingObserver) {
double s = 1d * scale / DEFAULT_SCALE;
double s = 1d * getScale() / DEFAULT_SCALE;
Shape clip = g2d.getClip().getBounds();
if (!clip.intersects(new Rectangle2D.Double(point.getX(), point.getY(), getImage().getIconWidth() * s, getImage()
.getIconHeight() * s))) {
@@ -171,14 +172,18 @@ public class Image extends AbstractTransparentComponent<Void> {
this.image = null;
}
@PercentEditor(_100PercentValue = 50)
@PercentEditor(_100PercentValue = 25)
@EditableProperty(defaultable = false)
public byte getScale() {
return scale;
if (scale != null) {
newScale = (byte) (scale / 2);
scale = null;
}
return newScale;
}
public void setScale(byte scale) {
this.scale = scale;
this.newScale = scale;
}
@Override
Binary file not shown.
+5 -1
View File
@@ -2496,7 +2496,7 @@
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Allow a file to be loaded if it references a missing component property, but show a warning.</description>
<description>Allow a file to be loaded if it references a missing component property, but show a warning</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
@@ -2518,6 +2518,10 @@
<changeType>NEW_FEATURE</changeType>
<description>Show wire diameter in mm and in next to AWG gauge</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Increase the range of zoom slider for images to 500%</description>
</org.diylc.appframework.update.Change>
</changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version>