Merge pull request #12466 from Nightfirecat/fix-bank-tag-separator-removal-scroll-position

banktags: Don't lose scroll position when hiding separators
This commit is contained in:
Jordan
2020-10-02 13:34:25 -07:00
committed by GitHub

View File

@@ -555,16 +555,18 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener
}
}
int itemContainerHeight = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER).getHeight();
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;
itemContainer.setScrollHeight(Math.max(adjustedScrollHeight, itemContainerHeight));
final int itemContainerScroll = bankItemContainer.getScrollY();
clientThread.invokeLater(() ->
client.runScript(ScriptID.UPDATE_SCROLLBAR,
WidgetInfo.BANK_SCROLLBAR.getId(),
WidgetInfo.BANK_ITEM_CONTAINER.getId(),
0));
itemContainerScroll));
}