diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-14 12:18:59 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-14 12:18:59 +0300 |
commit | f51ad9fe9634c33e69e42bb04beec3db896c323f (patch) | |
tree | cef9d71479e70af0f2e7896be8b044b2b707d8eb /src/ui | |
parent | eabae64f99804c1c7521ca55d3eb883e7880df4f (diff) |
Widget: Prevent overflow scrolling if not tall
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/widget.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ui/widget.c b/src/ui/widget.c index 4749de23..1a0b2ce7 100644 --- a/src/ui/widget.c +++ b/src/ui/widget.c | |||
@@ -928,9 +928,12 @@ iBool dispatchEvent_Widget(iWidget *d, const SDL_Event *ev) { | |||
928 | iBool scrollOverflow_Widget(iWidget *d, int delta) { | 928 | iBool scrollOverflow_Widget(iWidget *d, int delta) { |
929 | iRect bounds = bounds_Widget(d); | 929 | iRect bounds = bounds_Widget(d); |
930 | const iInt2 rootSize = size_Root(d->root); | 930 | const iInt2 rootSize = size_Root(d->root); |
931 | const iRect winRect = safeRect_Root(d->root); | 931 | const iRect winRect = safeRect_Root(d->root); |
932 | const int yTop = top_Rect(winRect); | 932 | const int yTop = top_Rect(winRect); |
933 | const int yBottom = bottom_Rect(winRect); | 933 | const int yBottom = bottom_Rect(winRect); |
934 | if (top_Rect(bounds) >= yTop && bottom_Rect(bounds) < yBottom) { | ||
935 | return iFalse; /* fits inside just fine */ | ||
936 | } | ||
934 | //const int safeBottom = rootSize.y - yBottom; | 937 | //const int safeBottom = rootSize.y - yBottom; |
935 | bounds.pos.y += delta; | 938 | bounds.pos.y += delta; |
936 | const iRangei range = { bottom_Rect(winRect) - height_Rect(bounds), yTop }; | 939 | const iRangei range = { bottom_Rect(winRect) - height_Rect(bounds), yTop }; |