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:
@@ -122,7 +122,9 @@ namespace OpenNest
|
|||||||
var entities = ConvertProgram.ToGeometry(BasePart.Program);
|
var entities = ConvertProgram.ToGeometry(BasePart.Program);
|
||||||
var nonRapid = entities.Where(e => e.Layer != SpecialLayers.Rapid).ToList();
|
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();
|
var bbox = BasePart.Program.BoundingBox();
|
||||||
return new Vector(bbox.Location.X + bbox.Width / 2, bbox.Location.Y + bbox.Length / 2);
|
return new Vector(bbox.Location.X + bbox.Width / 2, bbox.Location.Y + bbox.Length / 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user