Added few chassis-related components under "Electromechanical" category

fixed thin line style when zoomed in
This commit is contained in:
Branislav Stojkovic
2018-12-18 18:38:39 +01:00
parent 680397b44f
commit 3fec176fc1
13 changed files with 406 additions and 8 deletions
@@ -62,7 +62,8 @@ public abstract class AbstractComponent<T> implements IDIYComponent<T> {
public static Color LABEL_COLOR = Color.black;
public static Color LABEL_COLOR_SELECTED = Color.red;
public static Font LABEL_FONT = new Font("Tahoma", Font.PLAIN, 14);
public static Color METAL_COLOR = Color.decode("#759DAF");
public static Color METAL_COLOR = Color.decode("#759DAF");
public static Color LIGHT_METAL_COLOR = Color.decode("#EEEEEE");
public static Color COPPER_COLOR = Color.decode("#DA8A67");
@EditableProperty(defaultable = false)
@@ -403,11 +403,11 @@ class G2DWrapper extends Graphics2D implements IDrawingObserver {
@Override
public void setStroke(Stroke s) {
if (this.zoom > 1 && s.getClass() == BasicStroke.class) {
if (this.zoom > 1 && s instanceof BasicStroke) {
BasicStroke bs = (BasicStroke) s;
// make thin lines even thinner to compensate for zoom factor
if (bs.getLineWidth() <= 2)
s = ObjectCache.getInstance().fetchBasicStroke((float) (bs.getLineWidth() / zoom));
s = ObjectCache.getInstance().fetchStroke((float) (bs.getLineWidth() / zoom), bs.getDashArray(), bs.getDashPhase());
}
canvasGraphics.setStroke(s);
}
@@ -36,7 +36,7 @@ public class Constants {
public static Color CANVAS_COLOR = Color.white;
public static final Stroke DASHED_STROKE = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10f,
new float[] {2.0f}, 0.0f);
new float[] {2.0f, 4.0f}, 0.0f);
public static final Theme DEFAULT_THEME = new Theme("Light", Constants.CANVAS_COLOR, new Color(240, 240, 240),
Color.black);