Variants of boards having explicit sizing mode fail when trying to add to a project

This commit is contained in:
Bane Stojkovic
2022-11-20 22:51:55 +01:00
parent 19e9d1692a
commit 50588a759d
7 changed files with 10 additions and 5 deletions
@@ -4189,6 +4189,10 @@
<org.diylc.appframework.update.Change> <org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType> <changeType>BUG_FIX</changeType>
<description>Do not apply any user-default property values when creating a standard datasheet model (e.g. a capacitor)</description> <description>Do not apply any user-default property values when creating a standard datasheet model (e.g. a capacitor)</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>Variants of boards having explicit sizing mode fail when trying to add to a project</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
</changes> </changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url> <url>https://github.com/bancika/diy-layout-creator/releases</url>
Binary file not shown.
@@ -325,10 +325,11 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
} }
public void setLength(Size length) { public void setLength(Size length) {
if (getMode() == BoardSizingMode.Explicit) { if (getMode() == BoardSizingMode.Explicit && length != null && width != null) {
setControlPoint(firstPoint, 0); setControlPoint(firstPoint, 0);
Point2D second = new Point2D.Double(firstPoint.getX() + length.convertToPixels(), firstPoint.getY() + width.convertToPixels()); Point2D second = new Point2D.Double(firstPoint.getX() + length.convertToPixels(),
setControlPoint(second, 1); firstPoint.getY() + width.convertToPixels());
setControlPoint(second, 1);
} }
this.length = length; this.length = length;
} }
@@ -343,7 +344,7 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
} }
public void setWidth(Size width) { public void setWidth(Size width) {
if (getMode() == BoardSizingMode.Explicit) { if (getMode() == BoardSizingMode.Explicit && length != null && width != null) {
setControlPoint(firstPoint, 0); setControlPoint(firstPoint, 0);
Point2D second = new Point2D.Double(firstPoint.getX() + length.convertToPixels(), firstPoint.getY() + width.convertToPixels()); Point2D second = new Point2D.Double(firstPoint.getX() + length.convertToPixels(), firstPoint.getY() + width.convertToPixels());
setControlPoint(second, 1); setControlPoint(second, 1);
Binary file not shown.
Binary file not shown.