diff --git a/Bonsai.Editor/GraphView/WorkflowEditorControl.Designer.cs b/Bonsai.Editor/GraphView/WorkflowEditorControl.Designer.cs index 28c73333..0e415a89 100644 --- a/Bonsai.Editor/GraphView/WorkflowEditorControl.Designer.cs +++ b/Bonsai.Editor/GraphView/WorkflowEditorControl.Designer.cs @@ -93,7 +93,7 @@ private void InitializeComponent() // this.splitContainer.Panel2.Controls.Add(this.tabControl); this.splitContainer.Size = new System.Drawing.Size(300, 200); - this.splitContainer.SplitterDistance = 100; + this.splitContainer.SplitterDistance = 300; this.splitContainer.SplitterWidth = 3; this.splitContainer.TabIndex = 1; // diff --git a/Bonsai.Editor/GraphView/WorkflowEditorControl.cs b/Bonsai.Editor/GraphView/WorkflowEditorControl.cs index f156e54e..8b4cb850 100644 --- a/Bonsai.Editor/GraphView/WorkflowEditorControl.cs +++ b/Bonsai.Editor/GraphView/WorkflowEditorControl.cs @@ -87,6 +87,7 @@ public void ExpandWebView(string label) { browserLabel.Text = label; splitContainer.Panel1Collapsed = false; + EnsureWebViewSize(); } public void CollapseWebView() @@ -264,6 +265,12 @@ protected override void OnLoad(EventArgs e) base.OnLoad(e); } + protected override void OnSizeChanged(EventArgs e) + { + EnsureWebViewSize(); + base.OnSizeChanged(e); + } + protected override void OnKeyDown(KeyEventArgs e) { editorService.OnKeyDown(e); @@ -437,6 +444,21 @@ protected override void ScaleControl(SizeF factor, BoundsSpecified specified) var adjustV = displayX - marginTop - displayX / 2 - 1; adjustMargin = new Padding(adjustH, adjustV, adjustH, adjustH); } + splitContainer.SplitterDistance = (int)Math.Round(splitContainer.SplitterDistance * factor.Width); + splitContainer.Panel1MinSize = splitContainer.SplitterDistance / 2; + splitContainer.FixedPanel = FixedPanel.Panel1; + } + + private void EnsureWebViewSize() + { + if (splitContainer.FixedPanel != FixedPanel.None) + { + if (Width < 4 * splitContainer.Panel1MinSize) + { + splitContainer.SplitterDistance = Width / 2; + } + else splitContainer.SplitterDistance = 2 * splitContainer.Panel1MinSize - splitContainer.SplitterWidth; + } } private void InitializeTheme(TabPage tabPage)