mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
ground work for potentiometer views
This commit is contained in:
@@ -78,7 +78,9 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
|||||||
protected Color nutColor = NUT_COLOR;
|
protected Color nutColor = NUT_COLOR;
|
||||||
protected Color waferColor = WAFER_COLOR;
|
protected Color waferColor = WAFER_COLOR;
|
||||||
protected Type type = Type.ThroughHole;
|
protected Type type = Type.ThroughHole;
|
||||||
|
@Deprecated
|
||||||
protected boolean showShaft = false;
|
protected boolean showShaft = false;
|
||||||
|
protected View view;
|
||||||
// Array of 7 elements: 3 lug connectors, 1 pot body and 3 lugs
|
// Array of 7 elements: 3 lug connectors, 1 pot body and 3 lugs
|
||||||
transient protected Area[] body = null;
|
transient protected Area[] body = null;
|
||||||
|
|
||||||
@@ -219,7 +221,8 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
|||||||
- holeDiameter / 2, holeDiameter, holeDiameter)));
|
- holeDiameter / 2, holeDiameter, holeDiameter)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getShowShaft()) {
|
|
||||||
|
if (getView() == View.ShaftUp) {
|
||||||
int nutSize = (int) NUT_SIZE.convertToPixels();
|
int nutSize = (int) NUT_SIZE.convertToPixels();
|
||||||
int shaftSize = (int) SHAFT_SIZE.convertToPixels();
|
int shaftSize = (int) SHAFT_SIZE.convertToPixels();
|
||||||
int[] xPoints = new int[6];
|
int[] xPoints = new int[6];
|
||||||
@@ -433,14 +436,16 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
|||||||
this.borderColor = borderColor;
|
this.borderColor = borderColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Show Shaft")
|
@EditableProperty(name = "View")
|
||||||
public boolean getShowShaft() {
|
public View getView() {
|
||||||
return showShaft;
|
if (view == null)
|
||||||
|
view = showShaft ? View.ShaftUp : View.ShaftDown;
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setShowShaft(boolean showShaft) {
|
public void setView(View view) {
|
||||||
this.showShaft = showShaft;
|
this.view = view;
|
||||||
this.body = null;
|
body = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EditableProperty(name = "Wafer")
|
@EditableProperty(name = "Wafer")
|
||||||
@@ -468,4 +473,19 @@ public class PotentiometerPanel extends AbstractPotentiometer {
|
|||||||
return value;
|
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