mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Clearer standing component (mainly diode) reversion
This commit is contained in:
+19
-2
@@ -51,6 +51,7 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
protected Color borderColor = Color.black;
|
protected Color borderColor = Color.black;
|
||||||
protected Color labelColor = LABEL_COLOR;
|
protected Color labelColor = LABEL_COLOR;
|
||||||
protected Display display = Display.NAME;
|
protected Display display = Display.NAME;
|
||||||
|
private boolean flipStanding = false;
|
||||||
|
|
||||||
protected AbstractLeadedComponent() {
|
protected AbstractLeadedComponent() {
|
||||||
super();
|
super();
|
||||||
@@ -78,8 +79,10 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
// When ending points are too close draw the component in standing
|
// When ending points are too close draw the component in standing
|
||||||
// mode.
|
// mode.
|
||||||
int width = getClosestOdd(this.width.convertToPixels());
|
int width = getClosestOdd(this.width.convertToPixels());
|
||||||
Shape body = new Ellipse2D.Double(points[0].x - width / 2,
|
Shape body = new Ellipse2D.Double((getFlipStanding() ? points[1]
|
||||||
points[0].y - width / 2, width, width);
|
: points[0]).x
|
||||||
|
- width / 2, (getFlipStanding() ? points[1] : points[0]).y
|
||||||
|
- width / 2, width, width);
|
||||||
Composite oldComposite = g2d.getComposite();
|
Composite oldComposite = g2d.getComposite();
|
||||||
if (alpha < MAX_ALPHA) {
|
if (alpha < MAX_ALPHA) {
|
||||||
g2d.setComposite(AlphaComposite.getInstance(
|
g2d.setComposite(AlphaComposite.getInstance(
|
||||||
@@ -456,4 +459,18 @@ public abstract class AbstractLeadedComponent<T> extends
|
|||||||
public void setLabelColor(Color labelColor) {
|
public void setLabelColor(Color labelColor) {
|
||||||
this.labelColor = labelColor;
|
this.labelColor = labelColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override this method with @EditableProperty annotation in child classes
|
||||||
|
* where standing mode is supported
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean getFlipStanding() {
|
||||||
|
return flipStanding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlipStanding(boolean flipStanding) {
|
||||||
|
this.flipStanding = flipStanding;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user