Transistors in TO-92, TO-1, TO-126, TO-220 and TO-3 packages no longer draw circles around their pins in outline mode; only the body outline and the label are drawn

This commit is contained in:
Bane Stojkovic
2026-11-12 10:57:46 +01:00
parent 3049d4910c
commit 2439510f35
7 changed files with 25 additions and 20 deletions
@@ -689,6 +689,10 @@
<changeType>BUG_FIX</changeType> <changeType>BUG_FIX</changeType>
<description>Opening an older project with a perfboard or another board warned that the file references unknown component properties</description> <description>Opening an older project with a perfboard or another board warned that the file references unknown component properties</description>
</org.diylc.appframework.update.Change> </org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>Transistors in TO-92, TO-1, TO-126, TO-220 and TO-3 packages drew circles around their pins in outline mode; only the body outline and the label are drawn now</description>
</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>
</org.diylc.appframework.update.Version> </org.diylc.appframework.update.Version>
@@ -254,17 +254,14 @@ public abstract class AbstractTransistorPackage extends AbstractLabeledComponent
return new Rectangle2D.Double(minX - margin, minY - margin, maxX - minX + 2 * margin, maxY - minY + 2 * margin); return new Rectangle2D.Double(minX - margin, minY - margin, maxX - minX + 2 * margin, maxY - minY + 2 * margin);
} }
// drawn after the body so that pins stay visible whatever its alpha; a null pinColor draws only // drawn after the body so that pins stay visible whatever its alpha
// the outline
protected void drawPins(Graphics2D g2d, int pinSize, Color pinColor, Color pinBorderColor) { protected void drawPins(Graphics2D g2d, int pinSize, Color pinColor, Color pinBorderColor) {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f)); g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
for (Point2D point : controlPoints) { for (Point2D point : controlPoints) {
Shape pin = new Ellipse2D.Double(point.getX() - pinSize / 2, point.getY() - pinSize / 2, Shape pin = new Ellipse2D.Double(point.getX() - pinSize / 2, point.getY() - pinSize / 2,
pinSize, pinSize); pinSize, pinSize);
if (pinColor != null) { g2d.setColor(pinColor);
g2d.setColor(pinColor); g2d.fill(pin);
g2d.fill(pin);
}
g2d.setColor(pinBorderColor); g2d.setColor(pinBorderColor);
g2d.draw(pin); g2d.draw(pin);
} }
@@ -233,8 +233,9 @@ public class TransistorTO1 extends AbstractTransistorPackage {
} }
g2d.draw(mainArea); g2d.draw(mainArea);
drawPins(g2d, pinSize, outlineMode ? null : PIN_COLOR, if (!outlineMode) {
outlineMode ? theme.getOutlineColor() : PIN_BORDER_COLOR); drawPins(g2d, pinSize, PIN_COLOR, PIN_BORDER_COLOR);
}
// Draw label. // Draw label.
g2d.setFont(project.getFont()); g2d.setFont(project.getFont());
@@ -295,8 +295,9 @@ public class TransistorTO126 extends AbstractTransistorPackage {
g2d.setComposite(oldComposite); g2d.setComposite(oldComposite);
drawPins(g2d, pinSize, outlineMode ? null : PIN_COLOR, if (!outlineMode) {
outlineMode ? theme.getOutlineColor() : PIN_BORDER_COLOR); drawPins(g2d, pinSize, PIN_COLOR, PIN_BORDER_COLOR);
}
// Draw label. // Draw label.
g2d.setFont(project.getFont()); g2d.setFont(project.getFont());
@@ -333,8 +333,9 @@ public class TransistorTO220 extends AbstractTransistorPackage {
g2d.draw(tabArea); g2d.draw(tabArea);
} }
drawPins(g2d, pinSize, outlineMode ? null : PIN_COLOR, if (!outlineMode) {
outlineMode ? theme.getOutlineColor() : PIN_BORDER_COLOR); drawPins(g2d, pinSize, PIN_COLOR, PIN_BORDER_COLOR);
}
// Draw label. // Draw label.
g2d.setFont(project.getFont()); g2d.setFont(project.getFont());
@@ -365,16 +365,16 @@ public class TransistorTO3 extends AbstractLabeledComponent<String>
// the pins leave through the bottom of the case, so they are drawn over it to stay visible // the pins leave through the bottom of the case, so they are drawn over it to stay visible
// whatever its alpha // whatever its alpha
for (int i = 0; i < 2; i++) { if (!outlineMode) {
Point2D point = getControlPoint(i); for (int i = 0; i < 2; i++) {
if (!outlineMode) { Point2D point = getControlPoint(i);
g2d.setColor(PIN_COLOR); g2d.setColor(PIN_COLOR);
g2d.fillOval((int) Math.round(point.getX() - pinSize / 2), g2d.fillOval((int) Math.round(point.getX() - pinSize / 2),
(int) Math.round(point.getY() - pinSize / 2), pinSize, pinSize); (int) Math.round(point.getY() - pinSize / 2), pinSize, pinSize);
g2d.setColor(PIN_BORDER_COLOR);
g2d.drawOval((int) Math.round(point.getX() - pinSize / 2),
(int) Math.round(point.getY() - pinSize / 2), pinSize, pinSize);
} }
g2d.setColor(outlineMode ? theme.getOutlineColor() : PIN_BORDER_COLOR);
g2d.drawOval((int) Math.round(point.getX() - pinSize / 2),
(int) Math.round(point.getY() - pinSize / 2), pinSize, pinSize);
} }
// Draw label. // Draw label.
@@ -223,8 +223,9 @@ public class TransistorTO92 extends AbstractTransistorPackage {
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1)); g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
g2d.draw(mainArea); g2d.draw(mainArea);
drawPins(g2d, pinSize, outlineMode ? null : PIN_COLOR, if (!outlineMode) {
outlineMode ? theme.getOutlineColor() : PIN_BORDER_COLOR); drawPins(g2d, pinSize, PIN_COLOR, PIN_BORDER_COLOR);
}
// Draw label. // Draw label.
g2d.setFont(project.getFont()); g2d.setFont(project.getFont());