mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
use red when selected
This commit is contained in:
+4
-2
@@ -6,6 +6,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
@@ -32,8 +33,9 @@ public class CopperTrace extends AbstractLeadedComponent<Void> {
|
||||
|
||||
@Override
|
||||
@EditableProperty(name = "Color")
|
||||
public Color getLeadColor() {
|
||||
return leadColor;
|
||||
public Color getLeadColor(ComponentState componentState) {
|
||||
return componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : leadColor;
|
||||
}
|
||||
|
||||
public void setLeadColor(Color leadColor) {
|
||||
|
||||
+6
-2
@@ -6,8 +6,10 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
|
||||
import org.diylc.components.AbstractLeadedComponent;
|
||||
import org.diylc.core.ComponentState;
|
||||
import org.diylc.core.IDIYComponent;
|
||||
import org.diylc.core.annotations.ComponentDescriptor;
|
||||
import org.diylc.core.annotations.EditableProperty;
|
||||
import org.diylc.core.measures.Size;
|
||||
|
||||
@ComponentDescriptor(name = "Jumper", author = "Branislav Stojkovic", category = "Connectivity", instanceNamePrefix = "J", description = "", zOrder = IDIYComponent.ABOVE_BOARD)
|
||||
@@ -25,8 +27,10 @@ public class Jumper extends AbstractLeadedComponent<Void> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Color getLeadColor() {
|
||||
return COLOR;
|
||||
@EditableProperty(name = "Color")
|
||||
public Color getLeadColor(ComponentState componentState) {
|
||||
return componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : COLOR;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
||||
+2
-1
@@ -31,7 +31,8 @@ public class SolderPad extends AbstractComponent<Color> {
|
||||
public void draw(Graphics2D g2d, ComponentState componentState, Project project) {
|
||||
int diameter = getClosestOdd(size.convertToPixels());
|
||||
int holeDiameter = getClosestOdd(HOLE_SIZE.convertToPixels());
|
||||
g2d.setColor(color);
|
||||
g2d.setColor(componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color);
|
||||
g2d.fillOval(point.x - diameter / 2, point.y - diameter / 2, diameter, diameter);
|
||||
g2d.setColor(Constants.CANVAS_COLOR);
|
||||
g2d.fillOval(point.x - holeDiameter / 2, point.y - holeDiameter / 2, holeDiameter,
|
||||
|
||||
+3
-1
@@ -21,6 +21,7 @@ public class TraceCut extends AbstractSinglePointComponent {
|
||||
public static Size SIZE = new Size(0.085d, SizeUnit.in);
|
||||
public static Color FILL_COLOR = Color.white;
|
||||
public static Color BORDER_COLOR = Color.red;
|
||||
public static Color SELECTION_COLOR = Color.blue;
|
||||
|
||||
private Size size = SIZE;
|
||||
private Color fillColor = FILL_COLOR;
|
||||
@@ -32,7 +33,8 @@ public class TraceCut extends AbstractSinglePointComponent {
|
||||
int dotDiameter = (size / 3 * 2) / 2 * 2 + 1;
|
||||
g2d.setColor(fillColor);
|
||||
g2d.fillRect(point.x - size / 2, point.y - size / 2, size, size);
|
||||
g2d.setColor(borderColor);
|
||||
g2d.setColor(componentState == ComponentState.SELECTED
|
||||
|| componentState == ComponentState.DRAGGING ? SELECTION_COLOR : borderColor);
|
||||
g2d.setStroke(new BasicStroke(1));
|
||||
g2d.drawRect(point.x - size / 2, point.y - size / 2, size, size);
|
||||
g2d
|
||||
|
||||
Reference in New Issue
Block a user