Fix display in Item Trader when large number of sockets are allocated #7234
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #7229
Description of the problem being solved:
Add a scrollBar to the Trader popup when the number of sockets reach a certain point. This allows the popup to show on even the smallest window PoB can be resized to. The rows are dynamically shown given they are within the scrollBar height, and in order to do this I had to change the anchoring from the row above it to a static sectionAnchor for all of them. That anchor is what is moved when the scrollBar offsets.
There are still some arbitrary numbers I used to fine-tune the UI so it would hide/show cleaner. The numbers in the hideShowFunc were trial and error, again whatever looked best personally.
I also fixed another odd bug I found where if you deallocate a socket after opening the Trader, and then opened it again, the previous socket controls still existed in the popup. I added a wipeTable in the close function for both the "Done" button and hitting escape so it's a clean slate every time you open the popup. The code related to this is the wipeTable in close() and adding "close" to the OpenPopup call at the bottom.
This PR also introduces a clean-ish way for any popup to use a scrollBar if needed, which wasn't easily possible before.
Link to a build that showcases this PR:
21 socket
6 socket
Before screenshot:
21 sockets
After screenshot:
21 sockets
6 sockets, scrollBar shows starting at 7