Closed XertroV closed 1 year ago
If there's no changes requested, I'll get to removing that dev code so it can be merged cleanly.
Hmm, there's a bug in the initial code where an extra page is requested -- after a request, new plugins are added but the rows are not drawn / measured correctly, which looks like the user has scrolled to the bottom. 910fbf3 refactors the code to use a 500ms debounce instead, which seems to work well during local testing.
For development stuff I recommend removing PluginManager
from your game folder entirely (eg. D:\Games\Trackmania\Openplanet\Plugins\PluginManager
) and then cloning the repo in your user folder. I think that should work fine.
For development stuff I recommend removing
PluginManager
from your game folder entirely (eg.D:\Games\Trackmania\Openplanet\Plugins\PluginManager
) and then cloning the repo in your user folder. I think that should work fine.
Works great.
I've cleaned up the code into one nice commit -- the previous code w/ commits is here: https://github.com/XertroV/plugin-manager/tree/infinite-scroll-dev-prev
Oh don't worry too much about having multiple commits, I can squash and merge everything into 1 commit. I'll put some inline comments in your code.
bump (just wanted to remind you that this PR exists -- I think all your comments were addressed.)
Thank you 😊
fixes #15
note: while in draft this PR probably contains a bunch of dev code -- i didn't know how else to get it to run alongside the normal plugin manager (but this seems to work). This will be removed for the final PR.
explanation of code bits:
m_initialListRendered
: to avoid immediately triggering a request for the 2nd page,m_initialListRendered
is false for the first frame. (On that frameUI::GetScrollMaxY()
returns 0 always. We still want to potentially request more pages whenGetScrollMaxY
is 0, though, because this condition is met with a tall thin window.)infinite scroll: it's pretty crude atm. basically we estimate the row height, and if the user get's close to viewing the last row then we initiate a request. The maths is pretty rough and works well enough but occasionally a page can be requested early if the user is very near the bottom (common with page 2 or 3). Suggestions welcome wrt improvements, but it's 80% atm so IDK if it's worth bothering with.