Skip to content

Commit

Permalink
Allow extension panel to grow without bounds (#11102)
Browse files Browse the repository at this point in the history
* Allow extension panel to grow without bounds

Removes the 500 units bound on the extension panel width. The panel can
be enlarged as much as needed, while respecting the minimum size of the
canvas panel, which remains as 200 units.

Also, the extension panel size is remembered during a session. Serves
both as a nice to have and a avoids a splitter bug.

Also, the workspace references extension is fixed so that it adapts to
bigger sizes. It didn't stretch beyond 600 units.

* Add comment to constant
  • Loading branch information
mmisol authored Sep 9, 2020
1 parent 1645144 commit fe1d34b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/Views/Core/DynamoView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="5*" MinWidth="200" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition MaxWidth="500"
<ColumnDefinition Width="0"
MinWidth="1"
Name="RightExtensionsViewColumn">
</ColumnDefinition>
Expand Down
22 changes: 20 additions & 2 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1816,9 +1816,12 @@ private void ExtensionHandle_MouseEnter(object sender, MouseEventArgs e)

private bool libraryCollapsed;
private bool extensionsCollapsed;
private GridLength? extensionsColumnWidth;

// Default side bar width
private const int defaultSideBarWidth = 200;
// By default the extension bar over canvas size ratio is 2/5
private const int DefaultExtensionBarWidthMultiplier = 2;

/// <summary>
/// Check if library is collapsed or expanded
Expand Down Expand Up @@ -1873,14 +1876,29 @@ private void UpdateLibraryCollapseIcon()
// Show the extensions right side bar when there is atleast one extension
private void HideOrShowRightSideBar()
{
if (ExtensionTabItems.Count < 1)
if (ExtensionTabItems.Count == 0)
{
if (RightExtensionsViewColumn.Width.Value != 0)
{
extensionsColumnWidth = RightExtensionsViewColumn.Width;
}
RightExtensionsViewColumn.Width = new GridLength(0, GridUnitType.Star);
collapsedExtensionSidebar.Visibility = Visibility.Collapsed;
}
else
{
RightExtensionsViewColumn.Width = new GridLength(defaultSideBarWidth, GridUnitType.Star);
// The introduction of extensionsColumnWidth is two-fold:
// 1. It allows the resized width to be remembered which is nice to have.
// 2. It allows to avoid a slider glitch which sets the panels size in pixel amount but using star,
// changing the proportions so that the initial value is counted as pixels after the first resize.
if (extensionsColumnWidth == null)
{
RightExtensionsViewColumn.Width = new GridLength(DefaultExtensionBarWidthMultiplier, GridUnitType.Star);
}
else
{
RightExtensionsViewColumn.Width = extensionsColumnWidth.Value;
}
collapsedExtensionSidebar.Visibility = Visibility.Visible;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
xmlns:ui="clr-namespace:Dynamo.UI;assembly=DynamoCoreWpf"
mc:Ignorable="d"
VerticalAlignment="Top"
HorizontalAlignment="Left">
HorizontalAlignment="Stretch">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
Expand Down Expand Up @@ -153,6 +153,7 @@
<TextBlock
Text="{Binding DetailsMessage}"
TextWrapping="Wrap"
TextAlignment="Center"
Foreground="{DynamicResource MemberButtonText}"
Margin="10"
FontSize="11">
Expand Down

0 comments on commit fe1d34b

Please sign in to comment.