mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
improved lead drawing
This commit is contained in:
Binary file not shown.
+7
-1
@@ -66,8 +66,14 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
|
|||||||
Shape shape = getBodyShape();
|
Shape shape = getBodyShape();
|
||||||
if (shape == null) {
|
if (shape == null) {
|
||||||
g2d.setStroke(new BasicStroke(getLeadThickness().convertToPixels()));
|
g2d.setStroke(new BasicStroke(getLeadThickness().convertToPixels()));
|
||||||
g2d.setColor(getLeadColor(componentState));
|
g2d.setColor(shouldShadeLeads() ? getLeadColor(componentState).darker()
|
||||||
|
: getLeadColor(componentState));
|
||||||
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
||||||
|
if (shouldShadeLeads()) {
|
||||||
|
g2d.setStroke(new BasicStroke(getLeadThickness().convertToPixels() - 2));
|
||||||
|
g2d.setColor(getLeadColor(componentState));
|
||||||
|
g2d.drawLine(points[0].x, points[0].y, points[1].x, points[1].y);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Rectangle shapeRect = shape.getBounds();
|
Rectangle shapeRect = shape.getBounds();
|
||||||
|
|||||||
+2
-2
@@ -72,7 +72,7 @@ public class AxialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Shape getBodyShape() {
|
protected Shape getBodyShape() {
|
||||||
return new Rectangle2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight()
|
return new Rectangle2D.Double(0f, 0f, getWidth().convertToPixels(),
|
||||||
.convertToPixels());
|
getClosestOdd(getHeight().convertToPixels()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -72,7 +72,7 @@ public class RadialCeramicDiskCapacitor extends AbstractLeadedComponent<Capacita
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Shape getBodyShape() {
|
protected Shape getBodyShape() {
|
||||||
return new Ellipse2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight()
|
return new Ellipse2D.Double(0f, 0f, getWidth().convertToPixels(), getClosestOdd(getHeight()
|
||||||
.convertToPixels());
|
.convertToPixels()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -73,7 +73,7 @@ public class RadialFilmCapacitor extends AbstractLeadedComponent<Capacitance> {
|
|||||||
@Override
|
@Override
|
||||||
protected Shape getBodyShape() {
|
protected Shape getBodyShape() {
|
||||||
double radius = getHeight().convertToPixels() * 0.7;
|
double radius = getHeight().convertToPixels() * 0.7;
|
||||||
return new RoundRectangle2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight()
|
return new RoundRectangle2D.Double(0f, 0f, getWidth().convertToPixels(),
|
||||||
.convertToPixels(), radius, radius);
|
getClosestOdd(getHeight().convertToPixels()), radius, radius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -72,7 +72,7 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Shape getBodyShape() {
|
protected Shape getBodyShape() {
|
||||||
return new Rectangle2D.Double(0f, 0f, getWidth().convertToPixels(), getHeight()
|
return new Rectangle2D.Double(0f, 0f, getWidth().convertToPixels(),
|
||||||
.convertToPixels());
|
getClosestOdd(getHeight().convertToPixels()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user