Skip to content

[Bugfix] 修复右上角按钮和对话框图层相对位置错误的问题#6194

Open
ToobLac wants to merge 12 commits into
HMCL-dev:mainfrom
ToobLac:fix-5796
Open

[Bugfix] 修复右上角按钮和对话框图层相对位置错误的问题#6194
ToobLac wants to merge 12 commits into
HMCL-dev:mainfrom
ToobLac:fix-5796

Conversation

@ToobLac

@ToobLac ToobLac commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

现在对话框在右上角三个按钮之上,而阴影背景在三个按钮之下,所以遮挡关系是正确的且能正常点击按钮

Fixes #5796 Fixes #5122 Fixes #6192

@ToobLac ToobLac marked this pull request as ready for review June 19, 2026 03:50
@Glavo

Glavo commented Jun 21, 2026

Copy link
Copy Markdown
Member

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for a custom overlay pane in JFXDialog, allowing dialogs to be rendered on a separate overlay container. The feedback highlights critical areas for improvement, including adding null checks to the overlayPaneProperty listener to prevent NullPointerExceptions, ensuring that the dialog content and overlay pane are properly made visible when showing a dialog without animations, and defaulting the overlay pane to the dialog itself if set to null to avoid errors elsewhere in the class.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/com/jfoenix/controls/JFXDialog.java
Comment thread HMCL/src/main/java/com/jfoenix/controls/JFXDialog.java
Comment thread HMCL/src/main/java/com/jfoenix/controls/JFXDialog.java
ToobLac and others added 3 commits June 21, 2026 15:21
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@Glavo

Glavo commented Jun 25, 2026

Copy link
Copy Markdown
Member

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for a custom overlay pane in JFXDialog. It adds a new constructor accepting an overlayPane and updates visibility, opacity, and transition animations to target the contentHolder and the custom overlayPane instead of the dialog itself. Decorator and DecoratorSkin are updated to manage this overlay pane, and DialogUtils is adjusted to pass it during dialog creation. Feedback on these changes suggests adding defensive null checks in the overlayPaneProperty listener of JFXDialog to prevent potential NullPointerExceptions, and directly utilizing the new 5-parameter constructor in DialogUtils to avoid redundant layout configurations.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/com/jfoenix/controls/JFXDialog.java
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/DialogUtils.java Outdated
@ToobLac ToobLac marked this pull request as draft June 25, 2026 14:53
@ToobLac ToobLac marked this pull request as ready for review June 26, 2026 05:49
@Minecraft269

Copy link
Copy Markdown

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for custom overlay panes in JFXDialog by adding an overlayPane property and updating the dialog display and animation logic to target the overlay pane and content holder separately. It also updates DialogUtils and Decorator to support this new overlay pane. The review feedback suggests removing commented-out dead code in JFXDialog.java and restoring a removed show method overload in DialogUtils.java to prevent breaking backward compatibility.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/com/jfoenix/controls/JFXDialog.java Outdated
Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/DialogUtils.java
@Minecraft269

Copy link
Copy Markdown

CC @Glavo can merge

@Minecraft269

Copy link
Copy Markdown

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a customizable overlayPane property to JFXDialog, allowing the dialog to use a separate overlay pane instead of itself, and updates DialogUtils and the window decorator to support this. However, the feedback highlights that removing visibility controls from JFXDialog itself breaks its lifecycle and state tracking. It is recommended to restore the visibility updates on JFXDialog during initialization, showing, closing, and resetting properties to ensure proper behavior.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines 161 to 162
private void initialize() {
this.setVisible(false);
this.getStyleClass().add(DEFAULT_STYLE_CLASS);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

移除 this.setVisible(false) 会导致 JFXDialog 自身的 visible 属性默认为 true 且在整个生命周期中保持为 true。这会破坏 DialogUtils.handleDialogShown 中的逻辑,导致 onDialogShown()requestFocus() 在对话框还未真正开始显示/渲染时就被立即调用(因为 dialog.isVisible() 始终为 true,不会走 else 分支的监听器逻辑)。这可能会导致焦点请求失败以及生命周期事件触发过早的问题。\n\n建议恢复对 JFXDialog 自身 visible 属性的初始化设置。

Suggested change
private void initialize() {
this.setVisible(false);
this.getStyleClass().add(DEFAULT_STYLE_CLASS);
private void initialize() {
this.setVisible(false);
this.getStyleClass().add(DEFAULT_STYLE_CLASS);

Comment on lines 316 to 322
} else {
setVisible(true);
setOpacity(1);
contentHolder.setVisible(true);
contentHolder.setOpacity(1);
getOverlayPane().setVisible(true);
getOverlayPane().setOpacity(1);
Event.fireEvent(JFXDialog.this, new JFXDialogEvent(JFXDialogEvent.OPENED));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

在没有动画直接显示对话框时,需要同步将 JFXDialog 自身的可见性设为 true,以确保 visible 属性状态正确。

        } else {
            this.setVisible(true);
            contentHolder.setVisible(true);
            contentHolder.setOpacity(1);
            getOverlayPane().setVisible(true);
            getOverlayPane().setOpacity(1);
            Event.fireEvent(JFXDialog.this, new JFXDialogEvent(JFXDialogEvent.OPENED));
        }

Comment on lines 335 to 341
} else {
setOpacity(0);
setVisible(false);
contentHolder.setOpacity(0);
contentHolder.setVisible(false);
getOverlayPane().setOpacity(0);
getOverlayPane().setVisible(false);
closeDialog();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

在没有动画直接关闭对话框时,需要同步将 JFXDialog 自身的可见性设为 false

        } else {
            this.setVisible(false);
            contentHolder.setOpacity(0);
            contentHolder.setVisible(false);
            getOverlayPane().setOpacity(0);
            getOverlayPane().setVisible(false);
            closeDialog();
        }

Comment on lines 385 to +387
private void resetProperties() {
this.setVisible(false);
contentHolder.setVisible(false);
getOverlayPane().setVisible(false);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

重置属性时,需要将 JFXDialog 自身的可见性重置为 false

Suggested change
private void resetProperties() {
this.setVisible(false);
contentHolder.setVisible(false);
getOverlayPane().setVisible(false);
private void resetProperties() {
this.setVisible(false);
contentHolder.setVisible(false);
getOverlayPane().setVisible(false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants