mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-12 02:02:16 +10:00
Ability to flip standing diodes
This commit is contained in:
Binary file not shown.
+19
-4
@@ -32,6 +32,7 @@ public class DiodePlastic extends AbstractLeadedComponent<String> {
|
|||||||
|
|
||||||
private String value = "";
|
private String value = "";
|
||||||
private Color markerColor = MARKER_COLOR;
|
private Color markerColor = MARKER_COLOR;
|
||||||
|
private boolean flipStanding = false;
|
||||||
|
|
||||||
public DiodePlastic() {
|
public DiodePlastic() {
|
||||||
super();
|
super();
|
||||||
@@ -45,6 +46,20 @@ public class DiodePlastic extends AbstractLeadedComponent<String> {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getStandingBodyColor() {
|
||||||
|
return getFlipStanding() ? getMarkerColor() : getBodyColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
@EditableProperty(name = "Reverse (standing)")
|
||||||
|
public boolean getFlipStanding() {
|
||||||
|
return flipStanding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlipStanding(boolean flipStanding) {
|
||||||
|
this.flipStanding = flipStanding;
|
||||||
|
}
|
||||||
|
|
||||||
@EditableProperty
|
@EditableProperty
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
@@ -87,8 +102,8 @@ public class DiodePlastic extends AbstractLeadedComponent<String> {
|
|||||||
protected void decorateComponentBody(Graphics2D g2d, boolean outlineMode) {
|
protected void decorateComponentBody(Graphics2D g2d, boolean outlineMode) {
|
||||||
Color finalMarkerColor;
|
Color finalMarkerColor;
|
||||||
if (outlineMode) {
|
if (outlineMode) {
|
||||||
Theme theme = (Theme) ConfigurationManager.getInstance().readObject(
|
Theme theme = (Theme) ConfigurationManager.getInstance()
|
||||||
IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
.readObject(IPlugInPort.THEME_KEY, Constants.DEFAULT_THEME);
|
||||||
finalMarkerColor = theme.getOutlineColor();
|
finalMarkerColor = theme.getOutlineColor();
|
||||||
} else {
|
} else {
|
||||||
finalMarkerColor = markerColor;
|
finalMarkerColor = markerColor;
|
||||||
@@ -96,8 +111,8 @@ public class DiodePlastic extends AbstractLeadedComponent<String> {
|
|||||||
g2d.setColor(finalMarkerColor);
|
g2d.setColor(finalMarkerColor);
|
||||||
int width = (int) getLength().convertToPixels();
|
int width = (int) getLength().convertToPixels();
|
||||||
int markerWidth = (int) MARKER_WIDTH.convertToPixels();
|
int markerWidth = (int) MARKER_WIDTH.convertToPixels();
|
||||||
g2d.fillRect(width - markerWidth, 0, markerWidth, getClosestOdd(getWidth()
|
g2d.fillRect(width - markerWidth, 0, markerWidth,
|
||||||
.convertToPixels()));
|
getClosestOdd(getWidth().convertToPixels()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Marker")
|
@EditableProperty(name = "Marker")
|
||||||
|
|||||||
Reference in New Issue
Block a user