Component leads on resistors, capacitors, etc disappear when they are

very short
This commit is contained in:
bancika
2020-04-22 08:44:09 +02:00
parent 2d34b2cf8a
commit c63b26b660
6 changed files with 33 additions and 1 deletions
@@ -3032,6 +3032,22 @@
</org.diylc.appframework.update.Change>
</changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version>
<org.diylc.appframework.update.Version>
<versionNumber>
<major>4</major>
<minor>6</minor>
<build>0</build>
</versionNumber>
<releaseDate>2020-04-20 00:00:00.000 CET</releaseDate>
<name></name>
<changes>
<org.diylc.appframework.update.Change>
<changeType>BUG_FIX</changeType>
<description>Component leads on resistors, capacitors, etc disappear when they are very short</description>
</org.diylc.appframework.update.Change>
</changes>
<url>https://github.com/bancika/diy-layout-creator/releases</url>
</org.diylc.appframework.update.Version>
</a>
</java.util.Arrays_-ArrayList>
Binary file not shown.
@@ -87,6 +87,8 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
// parameters for adjusting the label control point
protected transient Double gamma = null;
protected transient Double r = null;
private Boolean hideShortLeads = false;
protected AbstractLeadedComponent() {
super();
@@ -205,7 +207,7 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
double leadLength = (distance - calculatePinSpacing(shapeRect)) / 2;
// only draw leads longer than threshold
if (leadLength > LEAD_RENDER_THRESHOLD) {
if (leadLength > LEAD_RENDER_THRESHOLD || !getHideShortLeads()) {
if (shouldShadeLeads()) {
Stroke leadStroke = ObjectCache.getInstance().fetchBasicStroke(leadThickness - 1);
Color leadColor = getLeadColorForPainting(componentState);
@@ -716,6 +718,17 @@ public abstract class AbstractLeadedComponent<T> extends AbstractTransparentComp
return new Rectangle2D.Double(minX - margin, minY - margin, maxX - minX + 2 * margin, maxY - minY + 2 * margin);
}
// for internal use. Set this flag to true when replacing standard leads with flexible ones
public Boolean getHideShortLeads() {
if (hideShortLeads == null)
hideShortLeads = false;
return hideShortLeads;
}
public void setHideShortLeads(Boolean hideShortLeads) {
this.hideShortLeads = hideShortLeads;
}
public enum LabelOriantation {
Directional, Horizontal
@@ -74,6 +74,9 @@ public class FlexibleLeadsEditor implements IProjectEditor {
Point newP2 = new Point((int)Math.round(centerX + Math.cos(theta) * len / 2), (int)Math.round(centerY + Math.sin(theta) * len / 2));
leaded.setControlPoint(newP1, 0);
leaded.setControlPoint(newP2, 1);
// make the standard leads go away
leaded.setHideShortLeads(true);
// create leads
HookupWire w1 = new HookupWire();
Binary file not shown.
Binary file not shown.