From 358703f30719b6785078dc827db42b937dbc7902 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Wed, 8 Jan 2020 11:41:50 -0700 Subject: [PATCH] banktags: move new tagtab button to the bottom of the list To make way for the equipment button --- .../plugins/banktags/tabs/TabInterface.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java index 61b992036e..4126e3805f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java @@ -859,19 +859,21 @@ public class TabInterface --maxTabs; } - if (currentTabIndex + direction >= tabManager.size() || currentTabIndex + direction < 0) + int proposedIndex = currentTabIndex + direction; + int numTabs = tabManager.size() + 1; + + if (proposedIndex >= numTabs || proposedIndex < 0) { currentTabIndex = 0; } - - if ((tabManager.size() - (currentTabIndex + direction) >= maxTabs) && (currentTabIndex + direction > -1)) + else if (numTabs - proposedIndex >= maxTabs) { - currentTabIndex += direction; + currentTabIndex = proposedIndex; } - else if (maxTabs < tabManager.size() && tabManager.size() - (currentTabIndex + direction) < maxTabs) + else if (maxTabs < numTabs && numTabs - proposedIndex < maxTabs) { // Edge case when only 1 tab displays instead of up to maxTabs when one is deleted at the end of the list - currentTabIndex += direction; + currentTabIndex = proposedIndex; scrollTab(-1); } @@ -952,7 +954,7 @@ public class TabInterface { int y = bounds.y + MARGIN + BUTTON_HEIGHT; - if (maxTabs >= tabManager.size()) + if (maxTabs > tabManager.size()) { currentTabIndex = 0; } @@ -978,6 +980,8 @@ public class TabInterface y += TAB_HEIGHT + MARGIN; } + updateWidget(newTab, y); + boolean hidden = !(tabManager.size() > 0); upButton.setHidden(hidden);