mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-29 03:41:12 -04:00
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 <noreply@anthropic.com>
This commit is contained in:
1 parent
b65a9485c7
commit
8dded7f177
3 files changed
+7
-5
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ namespace OpenNest
|
||||
/// Draws the id over a disc of <paramref name="background"/>, so a line drawn through the
|
||||
/// label's point, such as a cut-off's own cut, does not strike through the number.
|
||||
/// </summary>
|
||||
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)
|
||||
|
||||
Reference in new issue
Block a user