소스 검색

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);
     }