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