From 4d77f6cdfb7b21d5a62ab14aa83f439d6e149656 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 16 Aug 2021 15:04:20 +0000 Subject: [PATCH] banktags: Fix bank scroll height with separators hidden (#13723) Prior to this change, an extra row of empty space was added to tag tabs with items reaching the end of a row (ie. multiples of 8) which led to scroll behavior not matching vanilla for tabs with enough items to require scrolling. This change fixes this behavior to add extra scroll height only when a new row is started. In addition to the 36 pixels of height allotted to each bank item row, an additional 4 pixels of height exists at the bottom of the bank item container. This change ensures that a bank tag scrolled to the bottom will have its items displaying at the exact same y values as that of a normal bank tab. --- .../net/runelite/client/plugins/banktags/BankTagsPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java index eb5da21a12..18d69b888b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java @@ -99,6 +99,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener private static final int ITEM_VERTICAL_SPACING = 36; private static final int ITEM_HORIZONTAL_SPACING = 48; private static final int ITEM_ROW_START = 51; + private static final int ITEM_CONTAINER_BOTTOM_PADDING = 4; private static final int MAX_RESULT_COUNT = 250; @@ -551,8 +552,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener final Widget bankItemContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER); int itemContainerHeight = bankItemContainer.getHeight(); - // add a second row of height here to allow users to scroll down when the last row is partially visible - int adjustedScrollHeight = (items / ITEMS_PER_ROW) * ITEM_VERTICAL_SPACING + ITEM_VERTICAL_SPACING; + final int adjustedScrollHeight = (Math.max(0, items - 1) / ITEMS_PER_ROW) * ITEM_VERTICAL_SPACING + ITEM_VERTICAL_SPACING + ITEM_CONTAINER_BOTTOM_PADDING; itemContainer.setScrollHeight(Math.max(adjustedScrollHeight, itemContainerHeight)); final int itemContainerScroll = bankItemContainer.getScrollY();