Threads on 1/4" Closed Jack were not rendered at all

This commit is contained in:
bancika
2020-03-25 20:06:51 +01:00
parent 7c87ab075d
commit e429f65ed2
4 changed files with 17 additions and 12 deletions
@@ -2738,6 +2738,10 @@
<changeType>BUG_FIX</changeType>
<description>Hide the 3rd control point for components that do not need it (Trace, Jumper, Line)</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>Threads on 1/4" Closed Jack were not rendered at all</description>
</org.diylc.appframework.update.Change>
</changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version>
@@ -1,6 +1,7 @@
package org.diylc.components;
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.Area;
import org.diylc.common.ObjectCache;
@@ -13,7 +14,7 @@ public abstract class AbstractMultiPartComponent<T> extends AbstractTransparentC
private static final long serialVersionUID = 1L;
public abstract Area[] getBody();
public abstract Shape[] getBody();
public void drawSelectionOutline(Graphics2D g2d, ComponentState componentState, boolean outlineMode, Project project,
IDrawingObserver drawingObserver) {
@@ -25,11 +26,11 @@ public abstract class AbstractMultiPartComponent<T> extends AbstractTransparentC
}
public Area getBodyOutline() {
Area[] body = getBody();
Shape[] body = getBody();
Area outline = new Area();
for (Area b : body)
if (b != null)
outline.add(b);
for (Shape b : body)
if (b != null && b instanceof Area)
outline.add((Area)b);
return outline;
}
}
@@ -77,7 +77,7 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
private Point[] controlPoints = new Point[] {new Point(0, 0)};
private JackType type = JackType.MONO;
private Orientation orientation = Orientation.DEFAULT;
transient private Area[] body;
transient private Shape[] body;
private String value = "";
public ClosedJack1_4() {
@@ -130,9 +130,9 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
return angle;
}
public Area[] getBody() {
public Shape[] getBody() {
if (body == null) {
body = new Area[5];
body = new Shape[5];
// Create body.
int x = controlPoints[0].x;
@@ -169,9 +169,9 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
}
path.lineTo(p.x, p.y);
}
Area pathArea = new Area(path);
pathArea.intersect(shaft);
body[2] = new Area(path);
// Area pathArea = new Area(path);
// pathArea.intersect(shaft);
body[2] = path;
// Create lugs.
Area lugs = new Area();
@@ -245,7 +245,7 @@ public class ClosedJack1_4 extends AbstractMultiPartComponent<String> {
g2d.draw(body[1]);
if (!outlineMode) {
g2d.setColor(SHAFT_COLOR.darker());
g2d.fill(body[2]);
// g2d.fill(body[2]);
g2d.draw(body[2]);
}
Binary file not shown.