From e8fe01aea2f52d3bc6e5de8542c4275fad7c784b Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Tue, 31 Mar 2026 15:30:40 -0400 Subject: [PATCH] feat: highlight hovered contour during lead-in placement Co-Authored-By: Claude Opus 4.6 (1M context) --- OpenNest/Actions/ActionLeadIn.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/OpenNest/Actions/ActionLeadIn.cs b/OpenNest/Actions/ActionLeadIn.cs index 3c4f178..b8a0177 100644 --- a/OpenNest/Actions/ActionLeadIn.cs +++ b/OpenNest/Actions/ActionLeadIn.cs @@ -26,6 +26,7 @@ namespace OpenNest.Actions private ShapeInfo hoveredContour; private ContextMenuStrip contextMenu; 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) : base(plateView) @@ -151,6 +152,23 @@ namespace OpenNest.Actions 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) return;