Переглянути джерело

Ensure the Position is valid if the slider is at end.

BDisp 1 рік тому
батько
коміт
30be0524e4
1 змінених файлів з 7 додано та 0 видалено
  1. 7 0
      Terminal.Gui/Views/Scroll.cs

+ 7 - 0
Terminal.Gui/Views/Scroll.cs

@@ -147,6 +147,13 @@ public class Scroll : View
 
         int barSize = Orientation == Orientation.Vertical ? ContentSize.Height : ContentSize.Width;
 
+        // Ensure the Position is valid if the slider is at end
+        if ((Orientation == Orientation.Vertical && location + _slider.Frame.Height == barSize)
+            || (Orientation == Orientation.Horizontal && location + _slider.Frame.Width == barSize))
+        {
+            return Size - barSize;
+        }
+
         return Math.Min (location * Size / barSize, Size - barSize);
     }