From 6ca0e9da92bf00f9a25b4ba51b5e01121a30c67d Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Tue, 31 Mar 2026 15:25:26 -0400 Subject: [PATCH] feat: gray overlay on all parts when ActionLeadIn is active Co-Authored-By: Claude Opus 4.6 (1M context) --- OpenNest/Actions/ActionLeadIn.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/OpenNest/Actions/ActionLeadIn.cs b/OpenNest/Actions/ActionLeadIn.cs index 65be24e..a5783b1 100644 --- a/OpenNest/Actions/ActionLeadIn.cs +++ b/OpenNest/Actions/ActionLeadIn.cs @@ -24,6 +24,7 @@ namespace OpenNest.Actions private double snapNormal; private bool hasSnap; private ContextMenuStrip contextMenu; + private static readonly Brush grayOverlay = new SolidBrush(Color.FromArgb(160, 180, 180, 180)); public ActionLeadIn(PlateView plateView) : base(plateView) @@ -134,6 +135,18 @@ namespace OpenNest.Actions private void OnPaint(object sender, PaintEventArgs e) { + var g = e.Graphics; + + // Gray overlay on all parts except the selected one + foreach (var lp in plateView.LayoutParts) + { + if (lp == selectedLayoutPart) + continue; + + if (lp.Path != null) + g.FillPath(grayOverlay, lp.Path); + } + if (!hasSnap || selectedPart == null) return; @@ -182,7 +195,6 @@ namespace OpenNest.Actions var piercePoint = leadIn.GetPiercePoint(snapPoint, snapNormal); var worldPierce = TransformToWorld(piercePoint); - var g = e.Graphics; var oldSmooth = g.SmoothingMode; g.SmoothingMode = SmoothingMode.AntiAlias; @@ -190,8 +202,8 @@ namespace OpenNest.Actions var pt1 = plateView.PointWorldToGraph(worldPierce); var pt2 = plateView.PointWorldToGraph(worldSnap); - using var pen = new Pen(Color.Yellow, 2.0f / plateView.ViewScale); - g.DrawLine(pen, pt1, pt2); + using var previewPen = new Pen(Color.Yellow, 2.0f / plateView.ViewScale); + g.DrawLine(previewPen, pt1, pt2); // Draw a small circle at the pierce point var radius = 3.0f / plateView.ViewScale;