Browse Source

Add private BarSize method.

BDisp 11 months ago
parent
commit
1804d08ae5
1 changed files with 4 additions and 2 deletions
  1. 4 2
      Terminal.Gui/Views/Scroll/Scroll.cs

+ 4 - 2
Terminal.Gui/Views/Scroll/Scroll.cs

@@ -74,7 +74,7 @@ public class Scroll : View
                 SetRelativeLayout (SupView.Frame.Size);
                 SetRelativeLayout (SupView.Frame.Size);
             }
             }
 
 
-            int barSize = Orientation == Orientation.Vertical ? GetContentSize ().Height : GetContentSize ().Width;
+            int barSize = BarSize;
 
 
             if (value + barSize > Size)
             if (value + barSize > Size)
             {
             {
@@ -126,7 +126,7 @@ public class Scroll : View
     protected internal override bool OnMouseEvent (MouseEvent mouseEvent)
     protected internal override bool OnMouseEvent (MouseEvent mouseEvent)
     {
     {
         int location = Orientation == Orientation.Vertical ? mouseEvent.Position.Y : mouseEvent.Position.X;
         int location = Orientation == Orientation.Vertical ? mouseEvent.Position.Y : mouseEvent.Position.X;
-        int barSize = Orientation == Orientation.Vertical ? GetContentSize ().Height : GetContentSize ().Width;
+        int barSize = BarSize;
 
 
         (int topLeft, int bottomRight) sliderPos = _orientation == Orientation.Vertical
         (int topLeft, int bottomRight) sliderPos = _orientation == Orientation.Vertical
                                                        ? new (_slider.Frame.Y, _slider.Frame.Bottom - 1)
                                                        ? new (_slider.Frame.Y, _slider.Frame.Bottom - 1)
@@ -207,6 +207,8 @@ public class Scroll : View
 
 
     internal ScrollBar? SupView => SuperView as ScrollBar;
     internal ScrollBar? SupView => SuperView as ScrollBar;
 
 
+    private int BarSize => Orientation == Orientation.Vertical ? GetContentSize ().Height : GetContentSize ().Width;
+
     private void SetScrollText ()
     private void SetScrollText ()
     {
     {
         TextDirection = Orientation == Orientation.Vertical ? TextDirection.TopBottom_LeftRight : TextDirection.LeftRight_TopBottom;
         TextDirection = Orientation == Orientation.Vertical ? TextDirection.TopBottom_LeftRight : TextDirection.LeftRight_TopBottom;