mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-13 10:42:09 +10:00
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:
+3
-6
@@ -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);
|
||||
}
|
||||
|
||||
// drawn after the body so that pins stay visible whatever its alpha; a null pinColor draws only
|
||||
// the outline
|
||||
// drawn after the body so that pins stay visible whatever its alpha
|
||||
protected void drawPins(Graphics2D g2d, int pinSize, Color pinColor, Color pinBorderColor) {
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1f));
|
||||
for (Point2D point : controlPoints) {
|
||||
Shape pin = new Ellipse2D.Double(point.getX() - pinSize / 2, point.getY() - pinSize / 2,
|
||||
pinSize, pinSize);
|
||||
if (pinColor != null) {
|
||||
g2d.setColor(pinColor);
|
||||
g2d.fill(pin);
|
||||
}
|
||||
g2d.setColor(pinColor);
|
||||
g2d.fill(pin);
|
||||
g2d.setColor(pinBorderColor);
|
||||
g2d.draw(pin);
|
||||
}
|
||||
|
||||
+3
-2
@@ -233,8 +233,9 @@ public class TransistorTO1 extends AbstractTransistorPackage {
|
||||
}
|
||||
g2d.draw(mainArea);
|
||||
|
||||
drawPins(g2d, pinSize, outlineMode ? null : PIN_COLOR,
|
||||
outlineMode ? theme.getOutlineColor() : PIN_BORDER_COLOR);
|
||||
if (!outlineMode) {
|
||||
drawPins(g2d, pinSize, PIN_COLOR, PIN_BORDER_COLOR);
|
||||
}
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
+3
-2
@@ -295,8 +295,9 @@ public class TransistorTO126 extends AbstractTransistorPackage {
|
||||
|
||||
g2d.setComposite(oldComposite);
|
||||
|
||||
drawPins(g2d, pinSize, outlineMode ? null : PIN_COLOR,
|
||||
outlineMode ? theme.getOutlineColor() : PIN_BORDER_COLOR);
|
||||
if (!outlineMode) {
|
||||
drawPins(g2d, pinSize, PIN_COLOR, PIN_BORDER_COLOR);
|
||||
}
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
+3
-2
@@ -333,8 +333,9 @@ public class TransistorTO220 extends AbstractTransistorPackage {
|
||||
g2d.draw(tabArea);
|
||||
}
|
||||
|
||||
drawPins(g2d, pinSize, outlineMode ? null : PIN_COLOR,
|
||||
outlineMode ? theme.getOutlineColor() : PIN_BORDER_COLOR);
|
||||
if (!outlineMode) {
|
||||
drawPins(g2d, pinSize, PIN_COLOR, PIN_BORDER_COLOR);
|
||||
}
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
+6
-6
@@ -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
|
||||
// whatever its alpha
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Point2D point = getControlPoint(i);
|
||||
if (!outlineMode) {
|
||||
if (!outlineMode) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Point2D point = getControlPoint(i);
|
||||
g2d.setColor(PIN_COLOR);
|
||||
g2d.fillOval((int) Math.round(point.getX() - pinSize / 2),
|
||||
(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.
|
||||
|
||||
+3
-2
@@ -223,8 +223,9 @@ public class TransistorTO92 extends AbstractTransistorPackage {
|
||||
g2d.setStroke(ObjectCache.getInstance().fetchBasicStroke(1));
|
||||
g2d.draw(mainArea);
|
||||
|
||||
drawPins(g2d, pinSize, outlineMode ? null : PIN_COLOR,
|
||||
outlineMode ? theme.getOutlineColor() : PIN_BORDER_COLOR);
|
||||
if (!outlineMode) {
|
||||
drawPins(g2d, pinSize, PIN_COLOR, PIN_BORDER_COLOR);
|
||||
}
|
||||
|
||||
// Draw label.
|
||||
g2d.setFont(project.getFont());
|
||||
|
||||
Reference in New Issue
Block a user