mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-13 02:32:09 +10:00
Fixed the issue of disappearing components in some edge cases
This commit is contained in:
@@ -68,6 +68,11 @@ public class CurvedTrace extends AbstractCurvedComponent<Void> implements ILayer
|
||||
return COLOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getClipMargin() {
|
||||
return size.convertToPixels() / 2 + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCurve(Path2D curve, Graphics2D g2d, ComponentState componentState, IDrawingObserver drawingObserver) {
|
||||
float thickness = (float) size.convertToPixels();
|
||||
|
||||
+10
-1
@@ -61,9 +61,18 @@ public class HookupWire extends AbstractCurvedComponent<AWG> implements IContinu
|
||||
return COLOR;
|
||||
}
|
||||
|
||||
private int getThickness() {
|
||||
return (int) (gauge.diameterIn() * Constants.PIXELS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT)) - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getClipMargin() {
|
||||
return getThickness() / 2d + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCurve(Path2D curve, Graphics2D g2d, ComponentState componentState, IDrawingObserver drawingObserver) {
|
||||
int thickness = (int) (gauge.diameterIn() * Constants.PIXELS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT)) - 1;
|
||||
int thickness = getThickness();
|
||||
Color curveColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: color;
|
||||
|
||||
+6
@@ -78,6 +78,12 @@ public class OrthogonalLine extends AbstractOrthogonalComponent<Void> implements
|
||||
g2d.draw(createIconPath(width, height));
|
||||
}
|
||||
|
||||
// an arrow head spreads one arrow size to either side of the end point it sits on
|
||||
@Override
|
||||
protected double getClipMargin() {
|
||||
return Math.max(getThickness().convertToPixels() / 2, getArrowSize().convertToPixels()) + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCurve(Path2D curve, Graphics2D g2d, ComponentState componentState,
|
||||
IDrawingObserver drawingObserver) {
|
||||
|
||||
+10
-1
@@ -65,9 +65,18 @@ public class OrthogonalWire extends AbstractOrthogonalComponent<AWG> implements
|
||||
return COLOR;
|
||||
}
|
||||
|
||||
private int getThickness() {
|
||||
return (int) (gauge.diameterIn() * Constants.PIXELS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT)) - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getClipMargin() {
|
||||
return getThickness() / 2d + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCurve(Path2D curve, Graphics2D g2d, ComponentState componentState, IDrawingObserver drawingObserver) {
|
||||
int thickness = (int) (gauge.diameterIn() * Constants.PIXELS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT)) - 1;
|
||||
int thickness = getThickness();
|
||||
Color curveColor =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
|
||||
: color;
|
||||
|
||||
+12
-3
@@ -83,12 +83,21 @@ public class TwistedWire extends AbstractCurvedComponent<Void> implements IConti
|
||||
return COLOR;
|
||||
}
|
||||
|
||||
private int getThickness() {
|
||||
return (int) (gauge.diameterIn() * Constants.PIXELS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT))
|
||||
- 1;
|
||||
}
|
||||
|
||||
// the two leads swing out to either side of the curve as they twist, see recalculate
|
||||
@Override
|
||||
protected double getClipMargin() {
|
||||
return getThickness() * 2 + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawCurve(Path2D curve, Graphics2D g2d, ComponentState componentState,
|
||||
IDrawingObserver drawingObserver) {
|
||||
int thickness =
|
||||
(int) (gauge.diameterIn() * Constants.PIXELS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT))
|
||||
- 1;
|
||||
int thickness = getThickness();
|
||||
Color curveColor1 =
|
||||
componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING
|
||||
? SELECTION_COLOR
|
||||
|
||||
Reference in New Issue
Block a user