mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 09:12:09 +10:00
Added 4-position Tele switch type to the "Lever Switch" component
This commit is contained in:
@@ -164,11 +164,16 @@ public class LeverSwitch extends AbstractTransparentComponent<String> implements
|
|||||||
int terminalLength = getClosestOdd(TERMINAL_LENGTH.convertToPixels());
|
int terminalLength = getClosestOdd(TERMINAL_LENGTH.convertToPixels());
|
||||||
int terminalWidth = getClosestOdd(TERMINAL_WIDTH.convertToPixels());
|
int terminalWidth = getClosestOdd(TERMINAL_WIDTH.convertToPixels());
|
||||||
|
|
||||||
if (type == LeverSwitchType.DP3T || type == LeverSwitchType.DP3T_5pos)
|
int yOffset;
|
||||||
|
if (type == LeverSwitchType.DP3T || type == LeverSwitchType.DP4T || type == LeverSwitchType.DP3T_5pos) {
|
||||||
x += terminalLength;
|
x += terminalLength;
|
||||||
|
yOffset = 7;
|
||||||
|
} else {
|
||||||
|
yOffset = 12;
|
||||||
|
}
|
||||||
|
|
||||||
int baseX = x - terminalLength / 2 - waferSpacing;
|
int baseX = x - terminalLength / 2 - waferSpacing;
|
||||||
int baseY = y - (baseLength - terminalSpacing * (type == LeverSwitchType.DP3T || type == LeverSwitchType.DP3T_5pos ? 7 : 12)) / 2;
|
int baseY = y - (baseLength - terminalSpacing * yOffset) / 2;
|
||||||
Area baseArea = new Area(new Rectangle2D.Double(baseX, baseY, baseWidth, baseLength));
|
Area baseArea = new Area(new Rectangle2D.Double(baseX, baseY, baseWidth, baseLength));
|
||||||
baseArea.subtract(new Area(new Ellipse2D.Double(baseX + baseWidth / 2 - holeSize / 2, baseY
|
baseArea.subtract(new Area(new Ellipse2D.Double(baseX + baseWidth / 2 - holeSize / 2, baseY
|
||||||
+ (baseLength - holeSpacing) / 2 - holeSize / 2, holeSize, holeSize)));
|
+ (baseLength - holeSpacing) / 2 - holeSize / 2, holeSize, holeSize)));
|
||||||
@@ -178,7 +183,7 @@ public class LeverSwitch extends AbstractTransparentComponent<String> implements
|
|||||||
|
|
||||||
Area waferArea =
|
Area waferArea =
|
||||||
new Area(new Rectangle2D.Double(x - terminalLength / 2 - waferThickness / 2, y
|
new Area(new Rectangle2D.Double(x - terminalLength / 2 - waferThickness / 2, y
|
||||||
- (waferLength - terminalSpacing * (type == LeverSwitchType.DP3T || type == LeverSwitchType.DP3T_5pos ? 7 : 12)) / 2, waferThickness,
|
- (waferLength - terminalSpacing * yOffset) / 2, waferThickness,
|
||||||
waferLength));
|
waferLength));
|
||||||
|
|
||||||
if (type == LeverSwitchType._4P5T) {
|
if (type == LeverSwitchType._4P5T) {
|
||||||
@@ -221,6 +226,7 @@ public class LeverSwitch extends AbstractTransparentComponent<String> implements
|
|||||||
terminalArea.add(terminal);
|
terminalArea.add(terminal);
|
||||||
if (getHighlightCommon() &&
|
if (getHighlightCommon() &&
|
||||||
(((type == LeverSwitchType.DP3T || type == LeverSwitchType.DP3T_5pos) && (i == 1 || i == 6)) ||
|
(((type == LeverSwitchType.DP3T || type == LeverSwitchType.DP3T_5pos) && (i == 1 || i == 6)) ||
|
||||||
|
(type == LeverSwitchType.DP4T && (i == 1 || i == 8)) ||
|
||||||
((type == LeverSwitchType._4P5T || type == LeverSwitchType.DP5T) && (i == 0 || i == 11 || i == 12 || i == 23))))
|
((type == LeverSwitchType._4P5T || type == LeverSwitchType.DP5T) && (i == 0 || i == 11 || i == 12 || i == 23))))
|
||||||
commonTerminalArea.add(terminal);
|
commonTerminalArea.add(terminal);
|
||||||
else
|
else
|
||||||
@@ -259,6 +265,12 @@ public class LeverSwitch extends AbstractTransparentComponent<String> implements
|
|||||||
controlPoints[i] = new Point(x + (i % 2 == 1 ? terminalLength : 0), y + i * terminalSpacing);
|
controlPoints[i] = new Point(x + (i % 2 == 1 ? terminalLength : 0), y + i * terminalSpacing);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case DP4T:
|
||||||
|
controlPoints = new Point[10];
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
controlPoints[i] = new Point(x + (i % 2 == 1 ? terminalLength : 0), y + i * terminalSpacing);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case DP5T:
|
case DP5T:
|
||||||
controlPoints = new Point[12];
|
controlPoints = new Point[12];
|
||||||
for (int i = 0; i < 12; i++) {
|
for (int i = 0; i < 12; i++) {
|
||||||
@@ -402,7 +414,7 @@ public class LeverSwitch extends AbstractTransparentComponent<String> implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum LeverSwitchType {
|
public enum LeverSwitchType {
|
||||||
DP3T("DP3T (Standard 3-Position Strat)"), DP3T_5pos("DP3T (Standard 5-Position Strat)"), _4P5T("4P5T (Super/Mega)"), DP5T("DP5T");
|
DP3T("DP3T (Standard 3-Position Strat)"), DP3T_5pos("DP3T (Standard 5-Position Strat)"), _4P5T("4P5T (Super/Mega)"), DP4T("DP4T (4-Position Tele)"), DP5T("DP5T");
|
||||||
|
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@@ -429,6 +441,8 @@ public class LeverSwitch extends AbstractTransparentComponent<String> implements
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case DP3T:
|
case DP3T:
|
||||||
return 3;
|
return 3;
|
||||||
|
case DP4T:
|
||||||
|
return 4;
|
||||||
case DP3T_5pos:
|
case DP3T_5pos:
|
||||||
case DP5T:
|
case DP5T:
|
||||||
case _4P5T:
|
case _4P5T:
|
||||||
@@ -447,6 +461,8 @@ public class LeverSwitch extends AbstractTransparentComponent<String> implements
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case DP3T:
|
case DP3T:
|
||||||
return (index2 == 6 || index1 == 1) && index2 == index1 + 2 * (position + 1);
|
return (index2 == 6 || index1 == 1) && index2 == index1 + 2 * (position + 1);
|
||||||
|
case DP4T:
|
||||||
|
return (index2 == 8 || index1 == 1) && index2 - index1 == position + 1;
|
||||||
case DP3T_5pos:
|
case DP3T_5pos:
|
||||||
if (position % 2 == 0)
|
if (position % 2 == 0)
|
||||||
return (index2 == 6 || index1 == 1) && index2 == index1 + position + 2;
|
return (index2 == 6 || index1 == 1) && index2 == index1 + position + 2;
|
||||||
|
|||||||
Binary file not shown.
@@ -2522,6 +2522,10 @@
|
|||||||
<changeType>NEW_FEATURE</changeType>
|
<changeType>NEW_FEATURE</changeType>
|
||||||
<description>Added two or four terminal hookup to bass pickups types</description>
|
<description>Added two or four terminal hookup to bass pickups types</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>NEW_FEATURE</changeType>
|
||||||
|
<description>Added 4-position Tele switch type to the "Lever Switch" component</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>IMPROVEMENT</changeType>
|
<changeType>IMPROVEMENT</changeType>
|
||||||
<description>Increase the range of zoom slider for images to 500%</description>
|
<description>Increase the range of zoom slider for images to 500%</description>
|
||||||
|
|||||||
Reference in New Issue
Block a user