diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/library/main.jar b/ diy-layout-creator --username bancika@gmail.com/DIYLC/library/main.jar index 1253fc93..4edbbd74 100644 Binary files a/ diy-layout-creator --username bancika@gmail.com/DIYLC/library/main.jar and b/ diy-layout-creator --username bancika@gmail.com/DIYLC/library/main.jar differ diff --git a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/components/AbstractCurvedComponent.java b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/components/AbstractCurvedComponent.java index e89f5e6f..5c35cecb 100644 --- a/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/components/AbstractCurvedComponent.java +++ b/ diy-layout-creator --username bancika@gmail.com/DIYLC/src/org/diylc/components/AbstractCurvedComponent.java @@ -20,8 +20,8 @@ public abstract class AbstractCurvedComponent extends AbstractTransparentComp public static Color GUIDELINE_COLOR = Color.blue; protected Point[] controlPoints = new Point[] { - new Point(-5 * Constants.GRID, -5 * Constants.GRID), new Point(0, -3 * Constants.GRID), - new Point(0, 3 * Constants.GRID), new Point(5 * Constants.GRID, 5 * Constants.GRID) }; + new Point(-5 * Constants.GRID, -5 * Constants.GRID), new Point(0, -5 * Constants.GRID), + new Point(0, 5 * Constants.GRID), new Point(5 * Constants.GRID, 5 * Constants.GRID) }; protected Color color = getDefaultColor(); @@ -30,9 +30,14 @@ public abstract class AbstractCurvedComponent extends AbstractTransparentComp * * @param curve * @param g2d + * @param componentState + */ + protected abstract void drawCurve(CubicCurve2D curve, Graphics2D g2d, + ComponentState componentState); + + /** + * @return default color. */ - protected abstract void drawCurve(CubicCurve2D curve, Graphics2D g2d); - protected abstract Color getDefaultColor(); @Override @@ -75,7 +80,7 @@ public abstract class AbstractCurvedComponent extends AbstractTransparentComp // g2d.setColor(color); // g2d.setStroke(new BasicStroke(thickness - 2)); // g2d.draw(path); - drawCurve(curve, g2d); + drawCurve(curve, g2d, componentState); g2d.setComposite(oldComposite); } diff --git a/ diy-layout-creator --username bancika@gmail.com/Library/lib/diylc.jar b/ diy-layout-creator --username bancika@gmail.com/Library/lib/diylc.jar index c4e64890..0da2674a 100644 Binary files a/ diy-layout-creator --username bancika@gmail.com/Library/lib/diylc.jar and b/ diy-layout-creator --username bancika@gmail.com/Library/lib/diylc.jar differ diff --git a/ diy-layout-creator --username bancika@gmail.com/Library/src/org/diylc/components/connectivity/CurvedTrace.java b/ diy-layout-creator --username bancika@gmail.com/Library/src/org/diylc/components/connectivity/CurvedTrace.java index 9b062c10..26714d0e 100644 --- a/ diy-layout-creator --username bancika@gmail.com/Library/src/org/diylc/components/connectivity/CurvedTrace.java +++ b/ diy-layout-creator --username bancika@gmail.com/Library/src/org/diylc/components/connectivity/CurvedTrace.java @@ -6,6 +6,7 @@ import java.awt.Graphics2D; import java.awt.geom.CubicCurve2D; import org.diylc.components.AbstractCurvedComponent; +import org.diylc.core.ComponentState; import org.diylc.core.IDIYComponent; import org.diylc.core.annotations.ComponentDescriptor; import org.diylc.core.annotations.EditableProperty; @@ -28,10 +29,11 @@ public class CurvedTrace extends AbstractCurvedComponent { } @Override - protected void drawCurve(CubicCurve2D curve, Graphics2D g2d) { + protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) { int thickness = size.convertToPixels(); g2d.setStroke(new BasicStroke(thickness)); - g2d.setColor(color); + g2d.setColor(componentState == ComponentState.SELECTED + || componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color); g2d.draw(curve); } diff --git a/ diy-layout-creator --username bancika@gmail.com/Library/src/org/diylc/components/connectivity/HookupWire.java b/ diy-layout-creator --username bancika@gmail.com/Library/src/org/diylc/components/connectivity/HookupWire.java index fe418e1b..81026d8e 100644 --- a/ diy-layout-creator --username bancika@gmail.com/Library/src/org/diylc/components/connectivity/HookupWire.java +++ b/ diy-layout-creator --username bancika@gmail.com/Library/src/org/diylc/components/connectivity/HookupWire.java @@ -6,6 +6,7 @@ import java.awt.Graphics2D; import java.awt.geom.CubicCurve2D; import org.diylc.components.AbstractCurvedComponent; +import org.diylc.core.ComponentState; import org.diylc.core.IDIYComponent; import org.diylc.core.annotations.ComponentDescriptor; import org.diylc.core.annotations.EditableProperty; @@ -27,15 +28,18 @@ public class HookupWire extends AbstractCurvedComponent { } @Override - protected void drawCurve(CubicCurve2D curve, Graphics2D g2d) { + protected void drawCurve(CubicCurve2D curve, Graphics2D g2d, ComponentState componentState) { int thickness = (int) (Math.pow(Math.E, -1.12436 - 0.11594 * value.getValue()) * Constants.GRID * Constants.GRIDS_PER_INCH * (1 + 2 * INSULATION_THICKNESS_PCT)); - g2d.setColor(color.darker()); + g2d.setColor(componentState == ComponentState.SELECTED + || componentState == ComponentState.DRAGGING ? SELECTION_COLOR : color.darker()); g2d.setStroke(new BasicStroke(thickness)); g2d.draw(curve); - g2d.setColor(color); - g2d.setStroke(new BasicStroke(thickness - 2)); - g2d.draw(curve); + if (componentState == ComponentState.NORMAL) { + g2d.setColor(color); + g2d.setStroke(new BasicStroke(thickness - 2)); + g2d.draw(curve); + } } @EditableProperty(name = "AWG")