mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
ground work for potentiometer views
This commit is contained in:
@@ -77,8 +77,10 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
||||
protected Color borderColor = BORDER_COLOR;
|
||||
protected Color nutColor = NUT_COLOR;
|
||||
protected Color waferColor = WAFER_COLOR;
|
||||
protected Type type = Type.ThroughHole;
|
||||
protected boolean showShaft = false;
|
||||
protected Type type = Type.ThroughHole;
|
||||
@Deprecated
|
||||
protected boolean showShaft = false;
|
||||
protected View view;
|
||||
// Array of 7 elements: 3 lug connectors, 1 pot body and 3 lugs
|
||||
transient protected Area[] body = null;
|
||||
|
||||
@@ -218,8 +220,9 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
||||
body[4 + i].subtract(new Area(new Ellipse2D.Double(controlPoints[i].x - holeDiameter / 2, controlPoints[i].y
|
||||
- holeDiameter / 2, holeDiameter, holeDiameter)));
|
||||
}
|
||||
}
|
||||
if (getShowShaft()) {
|
||||
}
|
||||
|
||||
if (getView() == View.ShaftUp) {
|
||||
int nutSize = (int) NUT_SIZE.convertToPixels();
|
||||
int shaftSize = (int) SHAFT_SIZE.convertToPixels();
|
||||
int[] xPoints = new int[6];
|
||||
@@ -432,15 +435,17 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
||||
public void setBorderColor(Color borderColor) {
|
||||
this.borderColor = borderColor;
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Show Shaft")
|
||||
public boolean getShowShaft() {
|
||||
return showShaft;
|
||||
}
|
||||
|
||||
public void setShowShaft(boolean showShaft) {
|
||||
this.showShaft = showShaft;
|
||||
this.body = null;
|
||||
|
||||
@EditableProperty(name = "View")
|
||||
public View getView() {
|
||||
if (view == null)
|
||||
view = showShaft ? View.ShaftUp : View.ShaftDown;
|
||||
return view;
|
||||
}
|
||||
|
||||
public void setView(View view) {
|
||||
this.view = view;
|
||||
body = null;
|
||||
}
|
||||
|
||||
@EditableProperty(name = "Wafer")
|
||||
@@ -467,5 +472,20 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public enum View {
|
||||
ShaftDown("Shaft Down"), ShaftUp("Shaft Up");//, TerminalsDown, TerminalsUp;
|
||||
|
||||
private String value;
|
||||
|
||||
private View(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user