[Bug] MessageDialogPane 仍可能过高
问题描述 | Bug Description
#7240 统一限制了 Dialog 的宽度和高度,但是似乎 MessageDialogPane 在某些情况下仍然比较高,可能是以下部分的问题?
> HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/MessageDialogPane.java (Line 77 to line 86)
if (textFlow.computePrefHeight(400.0) <= 350.0)
content.getChildren().setAll(textFlow);
else {
ScrollPane scrollPane = new ScrollPane(textFlow);
FXUtils.smoothScrolling(scrollPane);
scrollPane.setPrefHeight(350);
VBox.setVgrow(scrollPane, Priority.ALWAYS);
scrollPane.setFitToWidth(true);
content.getChildren().setAll(scrollPane);
}
启动器崩溃报告 / 启动器日志文件 | Launcher Crash Report / Launcher Log File
我尝试在最新版复现: 新建一个纯文本文件,保存为 invalid.hmcl-theme。 在 HMCL 打开 设置 → 外观 → 主题 → 导入主题包,选择该文件。
是正常的弹窗宽高。你能确认一下复现的正确性,或者是否已经修复了吗
我尝试在最新版复现: 新建一个纯文本文件,保存为 invalid.hmcl-theme。 在 HMCL 打开 设置 → 外观 → 主题 → 导入主题包,选择该文件。
是正常的弹窗宽高。你能确认一下复现的正确性,或者是否已经修复了吗
基于最新 bfd18de 提交,在 ModListPage 的删除提示中测试:
...
private void initializeView() {
...
toolbarSelecting.getChildren().setAll(
createToolbarButton(i18n("button.remove"), SVG.DELETE_FOREVER, () -> {
Controllers.confirm(
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
i18n("button.remove"),
() -> {
removeSelected(listView.getSelectionModel().getSelectedItems());
}, null);
}),
...
补充:
嗯……?咱这边测试需要超过以下长度的文本才会被限制:
createToolbarButton(i18n("button.remove"), SVG.DELETE_FOREVER, () -> {
Controllers.confirm(
"000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
i18n("button.remove"),
() -> {
removeSelected(listView.getSelectionModel().getSelectedItems());
},
null
);
}),
| 未超过 | 超过(左图再加 1 字符) |
|---|---|
if (textFlow.computePrefHeight(400.0) <= 350.0)
content.getChildren().setAll(textFlow);
else {
ScrollPane scrollPane = new ScrollPane(textFlow);
ScrollUtils.installSmoothScrolling(scrollPane);
scrollPane.setPrefHeight(350);
VBox.setVgrow(scrollPane, Priority.ALWAYS);
scrollPane.setFitToWidth(true);
content.getChildren().setAll(scrollPane);
}
例如在 ModListPage,Controllers.getDecorator().contentHeightProperty().get() 输出 490.0,在 MessageDialogPane 已把整个窗口内容撑开的情况下, textFlow.computePrefHeight(400.0) 输出 335.15625,即面板溢出后计算结果仍然 <= 350.0,然后直接 getChildren().setAll(textFlow),没有使用 ScrollPane。