-
Notifications
You must be signed in to change notification settings - Fork 814
支持通过拖动标题栏退出最大化 #5172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
支持通过拖动标题栏退出最大化 #5172
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -328,6 +328,18 @@ private Node createNavBar(Decorator skinnable, double leftPaneWidth, boolean can | |||||||||||||||||
| } | ||||||||||||||||||
| if (onTitleBarDoubleClick != null) | ||||||||||||||||||
| center.setOnMouseClicked(onTitleBarDoubleClick); | ||||||||||||||||||
| center.setOnMouseDragged(mouseEvent -> { | ||||||||||||||||||
| if (!getSkinnable().isDragging() && primaryStage.isMaximized()) { | ||||||||||||||||||
| getSkinnable().setDragging(true); | ||||||||||||||||||
| mouseInitX = mouseEvent.getScreenX(); | ||||||||||||||||||
| mouseInitY = mouseEvent.getScreenY(); | ||||||||||||||||||
| primaryStage.setMaximized(false); | ||||||||||||||||||
| stageInitWidth = primaryStage.getWidth(); | ||||||||||||||||||
| stageInitHeight = primaryStage.getHeight(); | ||||||||||||||||||
| primaryStage.setY(stageInitY = 0); | ||||||||||||||||||
| primaryStage.setX(stageInitX = mouseInitX - stageInitWidth / 2); | ||||||||||||||||||
|
Comment on lines
+339
to
+340
|
||||||||||||||||||
| primaryStage.setY(stageInitY = 0); | |
| primaryStage.setX(stageInitX = mouseInitX - stageInitWidth / 2); | |
| double newStageY = 0; | |
| double newStageX = mouseInitX - stageInitWidth / 2; | |
| primaryStage.setY(newStageY); | |
| primaryStage.setX(newStageX); | |
| stageInitY = newStageY; | |
| stageInitX = newStageX; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This handler only handles the initial un-maximize action but doesn't consume the event or continue the drag. After un-maximizing, you should either consume the event or delegate to the existing onMouseDragged logic to ensure smooth continuous dragging. Without this, there's a disconnect between the un-maximize action and subsequent drag behavior.