From 8dded7f177341bc925f9351c6eb90657028f0e0c Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Wed, 28 Oct 2026 07:44:48 -0400 Subject: [PATCH] fix(ui): draw cut-off ids on a disc of the cut-off line's color The plate-colored disc behind a cut-off id read as a notch in any part edge the cut runs along. An orange-red disc with a white id reads as a tag on the cut-off line instead, and still keeps the dashed line from striking it through. Co-Authored-By: Claude Opus 5.5 --- .../Controls/LayoutPartLabelZoomTests.cs | 2 +- OpenNest/Controls/PlateRenderer.cs | 6 ++++-- OpenNest/LayoutPart.cs | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/OpenNest.WinForms.Tests/Controls/LayoutPartLabelZoomTests.cs b/OpenNest.WinForms.Tests/Controls/LayoutPartLabelZoomTests.cs index 15460dcc..0a449e9c 100644 --- a/OpenNest.WinForms.Tests/Controls/LayoutPartLabelZoomTests.cs +++ b/OpenNest.WinForms.Tests/Controls/LayoutPartLabelZoomTests.cs @@ -54,7 +54,7 @@ public class LayoutPartLabelZoomTests using var image = new Bitmap(120, 120); using var g = Graphics.FromImage(image); g.Clear(Color.White); - layout.DrawLabel(g, "12", muted: false, Brushes.Yellow); + layout.DrawLabel(g, "12", Brushes.Yellow, Brushes.Black); Assert.Equal(shown, !IsBlank(image)); layout.ReleaseDisplayResources(); diff --git a/OpenNest/Controls/PlateRenderer.cs b/OpenNest/Controls/PlateRenderer.cs index e80781c7..25a127bd 100644 --- a/OpenNest/Controls/PlateRenderer.cs +++ b/OpenNest/Controls/PlateRenderer.cs @@ -281,9 +281,11 @@ namespace OpenNest.Controls { DrawCutOffLines(g); - // Over the lines, on a disc of the plate's color, so the cut does not strike them through. + // Over the lines, on a disc of the line's color so the cut does not strike them through. + // A disc of the plate's color read as a notch in any part edge the cut runs along. + using var disc = new SolidBrush(CutOffLineColor); foreach (var (part, id, muted) in cutOffLabels) - part.DrawLabel(g, id, muted, view.ColorScheme.LayoutFillBrush); + part.DrawLabel(g, id, muted ? Brushes.Gray : disc, Brushes.White); cutOffLabels.Clear(); } diff --git a/OpenNest/LayoutPart.cs b/OpenNest/LayoutPart.cs index 8c5bb413..228b5d98 100644 --- a/OpenNest/LayoutPart.cs +++ b/OpenNest/LayoutPart.cs @@ -173,7 +173,7 @@ namespace OpenNest /// Draws the id over a disc of , so a line drawn through the /// label's point, such as a cut-off's own cut, does not strike through the number. /// - internal void DrawLabel(Graphics g, string id, bool muted, Brush background) + internal void DrawLabel(Graphics g, string id, Brush background, Brush text) { var size = MeasureLabel(g, id); if (!LabelFits(size)) @@ -181,7 +181,7 @@ namespace OpenNest var diameter = LabelDiscDiameter(size); g.FillEllipse(background, _labelScreenPoint.X - diameter / 2, _labelScreenPoint.Y - diameter / 2, diameter, diameter); - DrawLabel(g, id, muted); + g.DrawString(id, ProgramIdFont, text, _labelScreenPoint.X, _labelScreenPoint.Y, LabelFormat); } private SizeF MeasureLabel(Graphics g, string id)