[release/3.6] 模组下载列表翻页后自动回到顶部 (#4433)

https://github.com/HMCL-dev/HMCL/pull/4170

Co-authored-by: 辞庐 <109708109+CiiLu@users.noreply.github.com>
This commit is contained in:
Glavo 2025-09-10 21:28:03 +08:00 committed by GitHub
parent 73f0eb472a
commit 881f5e7874
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -229,6 +229,7 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP
}
private static class ModDownloadListPageSkin extends SkinBase<DownloadListPage> {
private final JFXListView<RemoteMod> listView = new JFXListView<>();
protected ModDownloadListPageSkin(DownloadListPage control) {
super(control);
@ -449,6 +450,8 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP
boolean disableNext = disableAll || pageOffset == pageCount - 1;
nextPageButton.setDisable(disableNext);
lastPageButton.setDisable(disableNext);
listView.scrollTo(0);
};
FXUtils.onChange(control.pageCount, pageCountN -> {
@ -504,7 +507,6 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP
}
});
JFXListView<RemoteMod> listView = new JFXListView<>();
spinnerPane.setContent(listView);
Bindings.bindContent(listView.getItems(), getSkinnable().items);
FXUtils.onClicked(listView, () -> {