fix: increase max zoom and handle GDI+ thread race in PlateView

Raise ViewScaleMax from 3000 to 10000 for deeper zoom. Catch
InvalidOperationException in hoverTimer_Elapsed when GraphicsPath is
concurrently used by the paint thread.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 22:01:50 -04:00
parent a59911b38a
commit 5163b02f89
2 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ namespace OpenNest.Controls
{ {
ViewScale = 1.0f; ViewScale = 1.0f;
ViewScaleMin = 0.3f; ViewScaleMin = 0.3f;
ViewScaleMax = 3000; ViewScaleMax = 10000;
origin = new PointF(100, 100); origin = new PointF(100, 100);
} }
+8
View File
@@ -627,6 +627,8 @@ namespace OpenNest.Controls
{ {
var graphPt = PointControlToGraph(hoverPoint); var graphPt = PointControlToGraph(hoverPoint);
LayoutPart hitPart = null; LayoutPart hitPart = null;
try
{
for (var i = parts.Count - 1; i >= 0; --i) for (var i = parts.Count - 1; i >= 0; --i)
{ {
if (parts[i].Path.GetBounds().Contains(graphPt) && if (parts[i].Path.GetBounds().Contains(graphPt) &&
@@ -636,6 +638,12 @@ namespace OpenNest.Controls
break; break;
} }
} }
}
catch (InvalidOperationException)
{
// GraphicsPath in use by paint thread — skip this hover tick
return;
}
hoveredPart = hitPart; hoveredPart = hitPart;
showTooltip = hitPart != null; showTooltip = hitPart != null;