"Trace Cut" can now be placed horizontally or vertically when "Cut

Between Lines" is selected
This commit is contained in:
bancika
2020-04-15 10:01:15 +02:00
parent edefb8f7e3
commit 3ae44ca040
2 changed files with 25 additions and 5 deletions
@@ -2954,6 +2954,10 @@
<changeType>NEW_FEATURE</changeType>
<description>Transistor components can display pinout instead of name or value</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>NEW_FEATURE</changeType>
<description>"Trace Cut" can now be placed horizontally or vertically when "Cut Between Lines" is selected</description>
</org.diylc.appframework.update.Change>
<org.diylc.appframework.update.Change>
<changeType>IMPROVEMENT</changeType>
<description>Prevent the app from closing while running background operations, like saving and exporting files</description>
@@ -27,6 +27,7 @@ import java.awt.Point;
import java.awt.geom.Rectangle2D;
import org.diylc.common.ObjectCache;
import org.diylc.common.OrientationHV;
import org.diylc.common.SimpleComponentTransformer;
import org.diylc.components.AbstractComponent;
import org.diylc.components.boards.AbstractBoard;
@@ -63,7 +64,8 @@ public class TraceCut extends AbstractComponent<Void> {
@Deprecated
private Color borderColor = BORDER_COLOR;
private Color boardColor = AbstractBoard.BOARD_COLOR;
private Boolean cutBetweenHoles = false;
private Boolean cutBetweenHoles = false;
private OrientationHV orientation = OrientationHV.VERTICAL;
private Size holeSpacing = VeroBoard.SPACING;
protected Point point = new Point(0, 0);
@@ -81,8 +83,11 @@ public class TraceCut extends AbstractComponent<Void> {
int holeSpacing = getClosestOdd(getHoleSpacing().convertToPixels());
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
: getBoardColor());
drawingObserver.startTrackingContinuityArea(false);
g2d.fillRect(point.x - holeSpacing / 2 - cutWidth / 2, point.y - size / 2 - 1, cutWidth, size + 2);
drawingObserver.startTrackingContinuityArea(false);
if (getOrientation() == OrientationHV.VERTICAL)
g2d.fillRect(point.x - holeSpacing / 2 - cutWidth / 2, point.y - size / 2 - 1, cutWidth, size + 2);
else
g2d.fillRect(point.x - size / 2 - 1, point.y - holeSpacing / 2 - cutWidth / 2, size + 2, cutWidth);
drawingObserver.stopTrackingContinuityArea();
} else {
g2d.setColor(componentState == ComponentState.SELECTED || componentState == ComponentState.DRAGGING ? SELECTION_COLOR
@@ -193,7 +198,7 @@ public class TraceCut extends AbstractComponent<Void> {
this.borderColor = borderColor;
}
@EditableProperty(name = "Cut between holes")
@EditableProperty(name = "Cut Between Holes")
public boolean getCutBetweenHoles() {
if (cutBetweenHoles == null) {
cutBetweenHoles = false;
@@ -217,7 +222,7 @@ public class TraceCut extends AbstractComponent<Void> {
this.boardColor = boardColor;
}
@EditableProperty(name = "Hole spacing")
@EditableProperty(name = "Hole Spacing")
public Size getHoleSpacing() {
if (holeSpacing == null) {
holeSpacing = VeroBoard.SPACING;
@@ -227,6 +232,17 @@ public class TraceCut extends AbstractComponent<Void> {
public void setHoleSpacing(Size holeSpacing) {
this.holeSpacing = holeSpacing;
}
@EditableProperty(name = "Cut Orientation")
public OrientationHV getOrientation() {
if (orientation == null)
orientation = OrientationHV.VERTICAL;
return orientation;
}
public void setOrientation(OrientationHV orientation) {
this.orientation = orientation;
}
@Deprecated