mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
boards don't disappear when points are flipped
This commit is contained in:
Binary file not shown.
+10
-4
@@ -28,6 +28,8 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
protected String value = "";
|
||||
protected Point[] controlPoints = new Point[] { new Point(0, 0),
|
||||
new Point(DEFAULT_WIDTH.convertToPixels(), DEFAULT_HEIGHT.convertToPixels()) };
|
||||
protected Point firstPoint = new Point();
|
||||
protected Point secondPoint = new Point();
|
||||
|
||||
protected Color boardColor = BOARD_COLOR;
|
||||
protected Color borderColor = BORDER_COLOR;
|
||||
@@ -43,14 +45,14 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
/ MAX_ALPHA));
|
||||
}
|
||||
g2d.setColor(boardColor);
|
||||
g2d.fillRect(controlPoints[0].x, controlPoints[0].y, controlPoints[1].x
|
||||
- controlPoints[0].x, controlPoints[1].y - controlPoints[0].y);
|
||||
g2d.fillRect(firstPoint.x, firstPoint.y, secondPoint.x - firstPoint.x, secondPoint.y
|
||||
- firstPoint.y);
|
||||
g2d.setComposite(oldComposite);
|
||||
}
|
||||
g2d.setColor(componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
|
||||
g2d.drawRect(controlPoints[0].x, controlPoints[0].y, controlPoints[1].x
|
||||
- controlPoints[0].x, controlPoints[1].y - controlPoints[0].y);
|
||||
g2d.drawRect(firstPoint.x, firstPoint.y, secondPoint.x - firstPoint.x, secondPoint.y
|
||||
- firstPoint.y);
|
||||
// Do not track any changes that follow because the whole board has been
|
||||
// tracked so far.
|
||||
drawingObserver.stopTracking();
|
||||
@@ -97,6 +99,10 @@ public abstract class AbstractBoard extends AbstractTransparentComponent<String>
|
||||
@Override
|
||||
public void setControlPoint(Point point, int index) {
|
||||
controlPoints[index].setLocation(point);
|
||||
firstPoint.setLocation(Math.min(controlPoints[0].x, controlPoints[1].x), Math.min(
|
||||
controlPoints[0].y, controlPoints[1].y));
|
||||
secondPoint.setLocation(Math.max(controlPoints[0].x, controlPoints[1].x), Math.max(
|
||||
controlPoints[0].y, controlPoints[1].y));
|
||||
}
|
||||
|
||||
@EditableProperty
|
||||
|
||||
+4
-4
@@ -39,15 +39,15 @@ public class PerfBoard extends AbstractBoard {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
|
||||
/ MAX_ALPHA));
|
||||
}
|
||||
Point p = new Point(controlPoints[0]);
|
||||
Point p = new Point(firstPoint);
|
||||
int diameter = getClosestOdd(PAD_SIZE.convertToPixels());
|
||||
int holeDiameter = getClosestOdd(HOLE_SIZE.convertToPixels());
|
||||
int spacing = this.spacing.convertToPixels();
|
||||
|
||||
while (p.y < controlPoints[1].y - spacing) {
|
||||
p.x = controlPoints[0].x;
|
||||
while (p.y < secondPoint.y - spacing) {
|
||||
p.x = firstPoint.x;
|
||||
p.y += spacing;
|
||||
while (p.x < controlPoints[1].x - spacing) {
|
||||
while (p.x < secondPoint.x - spacing) {
|
||||
p.x += spacing;
|
||||
g2d.setColor(padColor);
|
||||
g2d.fillOval(p.x - diameter / 2, p.y - diameter / 2, diameter, diameter);
|
||||
|
||||
+4
-4
@@ -42,13 +42,13 @@ public class VeroBoard extends AbstractBoard {
|
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f * alpha
|
||||
/ MAX_ALPHA));
|
||||
}
|
||||
Point p = new Point(controlPoints[0]);
|
||||
Point p = new Point(firstPoint);
|
||||
int stripSize = getClosestOdd(STRIP_SIZE.convertToPixels());
|
||||
int holeSize = getClosestOdd(HOLE_SIZE.convertToPixels());
|
||||
int spacing = this.spacing.convertToPixels();
|
||||
|
||||
while (p.y < controlPoints[1].y - spacing) {
|
||||
p.x = controlPoints[0].x;
|
||||
while (p.y < secondPoint.y - spacing) {
|
||||
p.x = firstPoint.x;
|
||||
p.y += spacing;
|
||||
g2d.setColor(padColor);
|
||||
g2d.fillRect(p.x + SPACING.convertToPixels() / 2, p.y - stripSize / 2,
|
||||
@@ -56,7 +56,7 @@ public class VeroBoard extends AbstractBoard {
|
||||
g2d.setColor(padColor.darker());
|
||||
g2d.drawRect(p.x + SPACING.convertToPixels() / 2, p.y - stripSize / 2,
|
||||
controlPoints[1].x - spacing - p.x, stripSize);
|
||||
while (p.x < controlPoints[1].x - spacing) {
|
||||
while (p.x < secondPoint.x - spacing) {
|
||||
p.x += spacing;
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
g2d.fillOval(p.x - holeSize / 2, p.y - holeSize / 2, holeSize, holeSize);
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ public class DIL_IC extends AbstractTransparentComponent<String> {
|
||||
}
|
||||
}
|
||||
|
||||
static enum PinCount {
|
||||
public static enum PinCount {
|
||||
|
||||
_4, _8, _10, _12, _14, _16, _24, _32;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user