height fix on scroll

This commit is contained in:
2025-05-06 05:02:11 -05:00
parent ae4d9786b2
commit fe2521bee2
@@ -71,13 +71,13 @@ public class Scroll extends Element {
}
int calculateScrollBarHeight() {
if (maxScroll <= 0) return height; // No scrolling needed
if (maxScroll <= 0) return height - (scrollBarPadding.value * 2); // No scrolling needed
return Math.max(20, (height * height) / (height + maxScroll)) - (scrollBarPadding.value * 2); // At least 20px tall
}
int calculateScrollBarY() {
int scrollBarHeight = calculateScrollBarHeight();
if (maxScroll <= 0) return 0;
if (maxScroll <= 0) return scrollBarPadding.value;
return (scroll * (height - scrollBarHeight)) / maxScroll + scrollBarPadding.value;
}
}