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:
@@ -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));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user