diff --git a/OpenNest/Forms/CuttingInspectionPanel.cs b/OpenNest/Forms/CuttingInspectionPanel.cs index de8db4e..36600e6 100644 --- a/OpenNest/Forms/CuttingInspectionPanel.cs +++ b/OpenNest/Forms/CuttingInspectionPanel.cs @@ -169,15 +169,14 @@ internal sealed class CuttingInspectionPanel : UserControl { view.InspectionCloseRequested = null; if (ReferenceEquals(view.Plate, plate)) - { - view.RestoreViewport(viewport); view.OverlapDisplay = overlapDisplay; - } } var ownedScope = scope; ownedScope?.Dispose(); scope = null; editor.FinishCuttingInspection(this); + if (!view.IsDisposed && ReferenceEquals(view.Plate, plate)) + view.RestoreViewport(viewport); ownedScope?.ResumeHostClose(); Dispose(); } diff --git a/OpenNest/Forms/EditNestForm.cs b/OpenNest/Forms/EditNestForm.cs index b23828b..4a824d6 100644 --- a/OpenNest/Forms/EditNestForm.cs +++ b/OpenNest/Forms/EditNestForm.cs @@ -325,7 +325,10 @@ namespace OpenNest.Forms content.Dock = DockStyle.Fill; sidePanel.Controls.Add(content); sidePanelTitle.Text = title; - viewSplitContainer.SplitterDistance = viewSplitContainer.Width - width; + var widest = System.Math.Max(viewSplitContainer.Panel1MinSize, + viewSplitContainer.Width - viewSplitContainer.Panel2MinSize - viewSplitContainer.SplitterWidth); + viewSplitContainer.SplitterDistance = System.Math.Clamp(viewSplitContainer.Width - width, + viewSplitContainer.Panel1MinSize, widest); viewSplitContainer.Panel2Collapsed = false; }