feat: highlight hovered contour during lead-in placement
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@ namespace OpenNest.Actions
|
|||||||
private ShapeInfo hoveredContour;
|
private ShapeInfo hoveredContour;
|
||||||
private ContextMenuStrip contextMenu;
|
private ContextMenuStrip contextMenu;
|
||||||
private static readonly Brush grayOverlay = new SolidBrush(Color.FromArgb(160, 180, 180, 180));
|
private static readonly Brush grayOverlay = new SolidBrush(Color.FromArgb(160, 180, 180, 180));
|
||||||
|
private static readonly Pen highlightPen = new Pen(Color.Cyan, 2.5f);
|
||||||
|
|
||||||
public ActionLeadIn(PlateView plateView)
|
public ActionLeadIn(PlateView plateView)
|
||||||
: base(plateView)
|
: base(plateView)
|
||||||
@@ -151,6 +152,23 @@ namespace OpenNest.Actions
|
|||||||
g.FillPath(grayOverlay, lp.Path);
|
g.FillPath(grayOverlay, lp.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Highlight the hovered contour
|
||||||
|
if (hoveredContour != null && selectedPart != null)
|
||||||
|
{
|
||||||
|
using var contourPath = hoveredContour.Shape.GetGraphicsPath();
|
||||||
|
|
||||||
|
// Translate from local part space to world space, then apply view transform
|
||||||
|
using var contourMatrix = new Matrix();
|
||||||
|
contourMatrix.Translate((float)selectedPart.Location.X, (float)selectedPart.Location.Y);
|
||||||
|
contourMatrix.Multiply(plateView.Matrix, MatrixOrder.Append);
|
||||||
|
contourPath.Transform(contourMatrix);
|
||||||
|
|
||||||
|
var prevSmooth = g.SmoothingMode;
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
g.DrawPath(highlightPen, contourPath);
|
||||||
|
g.SmoothingMode = prevSmooth;
|
||||||
|
}
|
||||||
|
|
||||||
if (!hasSnap || selectedPart == null)
|
if (!hasSnap || selectedPart == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user