From 033f94f33178ede859dfaf7cf6b895535f534167 Mon Sep 17 00:00:00 2001 From: Bane Stojkovic Date: Fri, 4 Sep 2026 13:13:03 +0200 Subject: [PATCH] Capacitor components now label their terminal nodes as '+' and '-' instead of '1' and '2' when 'Polarized' property is ticked --- diylc/diylc-core/src/main/resources/update.xml | 4 ++++ .../passive/AxialElectrolyticCapacitor.java | 13 +++++++++++++ .../components/passive/CapacitorSymbol.java | 13 +++++++++++++ .../components/passive/RadialElectrolytic.java | 16 +++++++++++++++- 4 files changed, 45 insertions(+), 1 deletion(-) diff --git a/diylc/diylc-core/src/main/resources/update.xml b/diylc/diylc-core/src/main/resources/update.xml index 6e20618c..53543e93 100644 --- a/diylc/diylc-core/src/main/resources/update.xml +++ b/diylc/diylc-core/src/main/resources/update.xml @@ -397,6 +397,10 @@ IMPROVEMENT Diode components now label their terminal nodes as 'A' (anode) and 'K' (cathode) instead of '1' and '2' + + IMPROVEMENT + Capacitor components now label their terminal nodes as '+' and '-' instead of '1' and '2' when 'Polarized' property is ticked + IMPROVEMENT Percentage values such as transparency Alpha, image Scale, etc, can have decimal values and not just integers diff --git a/diylc/diylc-library/src/main/java/org/diylc/components/passive/AxialElectrolyticCapacitor.java b/diylc/diylc-library/src/main/java/org/diylc/components/passive/AxialElectrolyticCapacitor.java index 2c62d5c1..dddf6a5d 100644 --- a/diylc/diylc-library/src/main/java/org/diylc/components/passive/AxialElectrolyticCapacitor.java +++ b/diylc/diylc-library/src/main/java/org/diylc/components/passive/AxialElectrolyticCapacitor.java @@ -203,6 +203,19 @@ public class AxialElectrolyticCapacitor extends AbstractLeadedComponent this.polarized = polarized; } + @Override + public String getControlPointNodeName(int index) { + if (getPolarized()) { + switch (index) { + case 0: + return "+"; + case 1: + return "-"; + } + } + return super.getControlPointNodeName(index); + } + public void drawIcon(Graphics2D g2d, int width, int height) { g2d.rotate(-Math.PI / 4, width / 2, height / 2); g2d.setColor(LEAD_COLOR); diff --git a/diylc/diylc-library/src/main/java/org/diylc/components/passive/RadialElectrolytic.java b/diylc/diylc-library/src/main/java/org/diylc/components/passive/RadialElectrolytic.java index 4a4f8ab8..bd61068f 100644 --- a/diylc/diylc-library/src/main/java/org/diylc/components/passive/RadialElectrolytic.java +++ b/diylc/diylc-library/src/main/java/org/diylc/components/passive/RadialElectrolytic.java @@ -72,6 +72,7 @@ public class RadialElectrolytic extends AbstractRadialComponent imp private boolean polarized = true; private boolean folded = false; private Size height = HEIGHT; + @Deprecated private boolean invert = false; public RadialElectrolytic() { @@ -304,7 +305,7 @@ public class RadialElectrolytic extends AbstractRadialComponent imp this.height = height; } - @EditableProperty(name = "Invert Polarity") +// @EditableProperty(name = "Invert Polarity") public boolean getInvert() { return invert; } @@ -313,6 +314,19 @@ public class RadialElectrolytic extends AbstractRadialComponent imp this.invert = invert; } + @Override + public String getControlPointNodeName(int index) { + if (getPolarized()) { + switch (index) { + case 0: + return getInvert() ? "-" : "+"; + case 1: + return getInvert() ? "+" : "-"; + } + } + return super.getControlPointNodeName(index); + } + @Override protected Shape getBodyShape() { double height = (int) getHeight().convertToPixels();