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:
@@ -29,7 +29,7 @@ namespace OpenNest.Controls
|
||||
{
|
||||
ViewScale = 1.0f;
|
||||
ViewScaleMin = 0.3f;
|
||||
ViewScaleMax = 3000;
|
||||
ViewScaleMax = 10000;
|
||||
origin = new PointF(100, 100);
|
||||
}
|
||||
|
||||
|
||||
@@ -627,15 +627,23 @@ namespace OpenNest.Controls
|
||||
{
|
||||
var graphPt = PointControlToGraph(hoverPoint);
|
||||
LayoutPart hitPart = null;
|
||||
for (var i = parts.Count - 1; i >= 0; --i)
|
||||
try
|
||||
{
|
||||
if (parts[i].Path.GetBounds().Contains(graphPt) &&
|
||||
parts[i].Path.IsVisible(graphPt))
|
||||
for (var i = parts.Count - 1; i >= 0; --i)
|
||||
{
|
||||
hitPart = parts[i];
|
||||
break;
|
||||
if (parts[i].Path.GetBounds().Contains(graphPt) &&
|
||||
parts[i].Path.IsVisible(graphPt))
|
||||
{
|
||||
hitPart = parts[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
// GraphicsPath in use by paint thread — skip this hover tick
|
||||
return;
|
||||
}
|
||||
|
||||
hoveredPart = hitPart;
|
||||
showTooltip = hitPart != null;
|
||||
|
||||
Reference in New Issue
Block a user