Open
Conversation
3gf8jv4dv
reviewed
Mar 27, 2026
Co-authored-by: 3gf8jv4dv <3gf8jv4dv@gmail.com>
Member
|
/gemini review |
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the FileSelector component to support a new SelectionMode enum, allowing for file, directory, or dual selection via a popup menu. It also adds a new SVG icon and corresponding localization strings. A review comment suggests adjusting the popup's horizontal alignment and vertical offset to prevent UI clipping and improve the user interface consistency.
| new IconedMenuItem(SVG.FOLDER_OPEN, i18n("selector.choose_directory"), () -> openDirectoryChooser(customField), selectModePopup) | ||
| ); | ||
|
|
||
| selectModePopup.show(selectButton, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.LEFT, selectButton.getWidth(), 0); |
Contributor
There was a problem hiding this comment.
弹出菜单的显示位置可能存在问题。在 HMCL 的设置界面中,文件选择按钮通常位于界面的最右侧。使用 PopupHPosition.LEFT 配合 selectButton.getWidth() 的偏移量,会使弹出菜单从按钮的右边缘开始向右展开,这极有可能导致菜单超出窗口边界而被裁剪。
建议将水平对齐方式改为 PopupHPosition.RIGHT,并将 Y 轴偏移量设置为按钮的高度,以便菜单能够对齐按钮右侧并向下展开,这更符合下拉菜单的交互习惯。
Suggested change
| selectModePopup.show(selectButton, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.LEFT, selectButton.getWidth(), 0); | |
| selectModePopup.show(selectButton, JFXPopup.PopupVPosition.TOP, JFXPopup.PopupHPosition.RIGHT, selectButton.getWidth(), selectButton.getHeight()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #5794
在仅支持选择文件和文件夹的地方的表现不变,而同时支持选择文件或文件夹的情况下弹出选项