Skip to content

Fix: Limit offline account skin dialog height#6231

Open
KSSJW wants to merge 1 commit into
HMCL-dev:mainfrom
KSSJW-Contribution:offline-account-skin-pane-dialog
Open

Fix: Limit offline account skin dialog height#6231
KSSJW wants to merge 1 commit into
HMCL-dev:mainfrom
KSSJW-Contribution:offline-account-skin-pane-dialog

Conversation

@KSSJW

@KSSJW KSSJW commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

修复OfflineAccountSkinPane占用的高度问题

缘由

  • OfflineAccountSkinPaneControllers.dialog()进行调用,在其内容过多的情况下,可能占满整个窗口的高度,且注意到DecoratorSkin(行254至260)中使用了如下语句,这会让标题栏右侧按钮保持在前。

更改

  • 通过setScaleX()setScaleYOfflineAccountSkinPane进行缩放以限制高度。
AnchorPane layer = new AnchorPane();
layer.setPickOnBounds(false);
layer.getChildren().add(buttonsContainer);
AnchorPane.setTopAnchor(buttonsContainer, 0.0);
AnchorPane.setRightAnchor(buttonsContainer, 0.0);
buttonsContainerPlaceHolder.widthProperty().bind(buttonsContainer.widthProperty());
parent.getChildren().add(layer);

实况

更改前 更改后
1 2

@KSSJW

KSSJW commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

/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 scales the OfflineAccountSkinPane to 85% on both axes before displaying it in a dialog. The review feedback correctly identifies that using setScaleX and setScaleY is a JavaFX anti-pattern because it does not affect layout bounds and can cause blurry rendering, and suggests using layout constraints like setMaxHeight instead.

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 +146 to +147
pane.setScaleX(0.85);
pane.setScaleY(0.85);

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

Using setScaleX and setScaleY in JavaFX is an anti-pattern for controlling layout size.

Why this is an issue:

  1. Layout Bounds Unchanged: Visual scaling via setScale does not affect the node's layoutBounds. The parent dialog container will still allocate space for the unscaled size, meaning the dialog window itself will still be excessively tall, leaving large empty margins around the scaled content.
  2. Blurry Rendering: Scaling vector UI controls and text by a non-integer factor (like 0.85) disables subpixel rendering alignment, making text, borders, and buttons look blurry and pixelated.

Recommended Solution:

Limit the dialog's height using layout constraints instead, such as setting a maximum height (setMaxHeight) on the pane, which the parent dialog container will respect during layout.

Suggested change
pane.setScaleX(0.85);
pane.setScaleY(0.85);
pane.setMaxHeight(550);

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant