summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-05-14 12:18:59 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-05-14 12:18:59 +0300
commitf51ad9fe9634c33e69e42bb04beec3db896c323f (patch)
treecef9d71479e70af0f2e7896be8b044b2b707d8eb /src/ui
parenteabae64f99804c1c7521ca55d3eb883e7880df4f (diff)
Widget: Prevent overflow scrolling if not tall
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/widget.c9
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) {
928iBool scrollOverflow_Widget(iWidget *d, int delta) { 928iBool 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 };