mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
add striped option for twisted pair
This commit is contained in:
@@ -64,12 +64,12 @@ public class ObjectCache {
|
||||
return stroke;
|
||||
}
|
||||
|
||||
public Stroke fetchStroke(float width, float[] dash, float phase) {
|
||||
String key = width + "|" + Arrays.toString(dash) + "|" + phase;
|
||||
public Stroke fetchStroke(float width, float[] dash, float phase, int cap) {
|
||||
String key = width + "|" + Arrays.toString(dash) + "|" + phase + "|" + phase;
|
||||
if (dashStrokeMap.containsKey(key)) {
|
||||
return dashStrokeMap.get(key);
|
||||
}
|
||||
Stroke stroke = new BasicStroke(width, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 0, dash, phase);
|
||||
Stroke stroke = new BasicStroke(width, cap, BasicStroke.JOIN_ROUND, 0, dash, phase);
|
||||
dashStrokeMap.put(key, stroke);
|
||||
return stroke;
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
|
||||
BasicStroke bs = (BasicStroke) s;
|
||||
// make thin lines even thinner to compensate for zoom factor
|
||||
if (bs.getLineWidth() <= 2 && !(s instanceof ZoomableStroke))
|
||||
s = ObjectCache.getInstance().fetchStroke((float) (bs.getLineWidth() / zoom), bs.getDashArray(), bs.getDashPhase());
|
||||
s = ObjectCache.getInstance().fetchStroke((float) (bs.getLineWidth() / zoom), bs.getDashArray(), bs.getDashPhase(), bs.getEndCap());
|
||||
}
|
||||
canvasGraphics.setStroke(s);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user