feat(ui): position part labels at polylabel center

Replace PathPoints[0] label positioning with polylabel algorithm
to place part ID labels at the visual center of each part. Labels
are now centered and readable even in dense nests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-16 20:46:47 -04:00
parent b647769b51
commit 79a3410bb9

View File

@@ -122,7 +122,9 @@ namespace OpenNest
var entities = ConvertProgram.ToGeometry(BasePart.Program);
var nonRapid = entities.Where(e => e.Layer != SpecialLayers.Rapid).ToList();
if (nonRapid.Count == 0)
var shapes = ShapeBuilder.GetShapes(nonRapid);
if (shapes.Count == 0)
{
var bbox = BasePart.Program.BoundingBox();
return new Vector(bbox.Location.X + bbox.Width / 2, bbox.Location.Y + bbox.Length / 2);