diff options
author | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-02-25 21:22:08 +0200 |
---|---|---|
committer | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-02-25 21:22:08 +0200 |
commit | cdb8f5981f418cae946a3c3fd60c5891ed3f323c (patch) | |
tree | a1bf584518e5ece68b16a2fed73a558fd81ac08d | |
parent | 5cab567e8b9ff95e2637459dc0d92f6696052100 (diff) | |
download | LibGui-cdb8f5981f418cae946a3c3fd60c5891ed3f323c.tar.gz LibGui-cdb8f5981f418cae946a3c3fd60c5891ed3f323c.tar.bz2 LibGui-cdb8f5981f418cae946a3c3fd60c5891ed3f323c.zip |
Make list panels always have at least one cell visible
If the children are higher than the layout height,
they should still be partially visible.
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java index 32e56c4..7c92191 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java @@ -111,8 +111,7 @@ public class WListPanel<D, W extends WWidget> extends WClippedPanel { if (cellHeight<4) cellHeight=4; int layoutHeight = this.getHeight()-(margin*2); - int cellsHigh = layoutHeight / cellHeight; - + int cellsHigh = Math.max(layoutHeight / cellHeight, 1); // At least one cell is always visible //System.out.println("Adding children..."); |