mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Tweaked autohide logic
This commit is contained in:
@@ -187,8 +187,8 @@ public partial class View
|
||||
{
|
||||
if (viewportSettings == ViewportSettings.None)
|
||||
{
|
||||
_horizontalScrollBar.Value.KeepContentInAllViewport = true;
|
||||
_verticalScrollBar.Value.KeepContentInAllViewport = true;
|
||||
//_horizontalScrollBar.Value.KeepContentInAllViewport = true;
|
||||
//_verticalScrollBar.Value.KeepContentInAllViewport = true;
|
||||
}
|
||||
else if (viewportSettings.HasFlag (ViewportSettings.AllowNegativeX))
|
||||
{
|
||||
@@ -205,16 +205,16 @@ public partial class View
|
||||
}
|
||||
else if (viewportSettings.HasFlag (ViewportSettings.AllowXGreaterThanContentWidth))
|
||||
{
|
||||
_horizontalScrollBar.Value.KeepContentInAllViewport = false;
|
||||
//_horizontalScrollBar.Value.KeepContentInAllViewport = false;
|
||||
}
|
||||
else if (viewportSettings.HasFlag (ViewportSettings.AllowYGreaterThanContentHeight))
|
||||
{
|
||||
_verticalScrollBar.Value.KeepContentInAllViewport = false;
|
||||
//_verticalScrollBar.Value.KeepContentInAllViewport = false;
|
||||
}
|
||||
else if (viewportSettings.HasFlag (ViewportSettings.AllowLocationGreaterThanContentSize))
|
||||
{
|
||||
_horizontalScrollBar.Value.KeepContentInAllViewport = false;
|
||||
_verticalScrollBar.Value.KeepContentInAllViewport = false;
|
||||
//_horizontalScrollBar.Value.KeepContentInAllViewport = false;
|
||||
//_verticalScrollBar.Value.KeepContentInAllViewport = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,11 +93,9 @@ public class ScrollBar : View, IOrientation, IDesignable
|
||||
|
||||
private void ShowHide ()
|
||||
{
|
||||
Visible = VisibleContentSize < ScrollableContentSize;
|
||||
|
||||
if (!AutoHide)
|
||||
if (AutoHide)
|
||||
{
|
||||
Visible = true;
|
||||
Visible = VisibleContentSize < ScrollableContentSize;
|
||||
}
|
||||
|
||||
if (Orientation == Orientation.Vertical)
|
||||
|
||||
@@ -922,15 +922,15 @@ public class ScrollBarTests (ITestOutputHelper output)
|
||||
top.Add (view);
|
||||
Application.Begin (top);
|
||||
|
||||
Assert.False (scrollBar.KeepContentInAllViewport);
|
||||
scrollBar.KeepContentInAllViewport = true;
|
||||
//Assert.False (scrollBar.KeepContentInAllViewport);
|
||||
//scrollBar.KeepContentInAllViewport = true;
|
||||
Assert.Equal (80, view.Padding.Viewport.Width);
|
||||
Assert.Equal (25, view.Padding.Viewport.Height);
|
||||
Assert.Equal (2, scrollBar.Viewport.Width);
|
||||
Assert.Equal (25, scrollBar.Viewport.Height);
|
||||
Assert.Equal (30, scrollBar.ScrollableContentSize);
|
||||
|
||||
scrollBar.KeepContentInAllViewport = false;
|
||||
//scrollBar.KeepContentInAllViewport = false;
|
||||
scrollBar.Position = 50;
|
||||
Assert.Equal (scrollBar.GetSliderPosition (), scrollBar.ScrollableContentSize - 1);
|
||||
Assert.Equal (scrollBar.GetSliderPosition (), view.Viewport.Y);
|
||||
|
||||
Reference in New Issue
Block a user