mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Component leads on resistors, capacitors, etc disappear when they are
very short
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user