Skip to content
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

fix currentWindow keeping reference to old modalstage #32

Merged
merged 1 commit into from
Sep 16, 2021

Conversation

SKeeneCode
Copy link
Collaborator

fix #31

When openModal is called, the default parameter for owner is currentWindow which will look for a Window in the following order:

  1. The components modalStage
  2. The components root.scene.window
  3. The primaryStage

The first time a modal window is opened the components currentWindow will return primaryStage and in the openModal function that component will have its root put into a newly built scene and that scene will become the scene of a newly made modalStage.

When the Modal Stage is closed the component has its modalstage set to null, but its root is still wrapped in a scene which is still the scene of that modal stage so next time openModal is called, the owner becomes the previous modal stage (because currentWindow will look at root.scene.window which points to the old modalstage).

This old modal stage is now the owner and because the owners position determines the starting position of the new modal stage it gets the placement wrong.

By removing the component as the root of the scene when closing the stage, it prevents that stage from being referenced by currentWindow in the future.

@the-rene
Copy link

Is there a reason, why this does not get merged?

As mentioned in #31, I can confirm, that this PR fixes the issue.

@edvin edvin merged commit 21e933f into edvin:master Sep 16, 2021
@edvin
Copy link
Owner

edvin commented Sep 16, 2021

Thanks for this, and sorry about the late reply. Merged now :)

@SKeeneCode SKeeneCode deleted the openmodal-bugfix branch December 15, 2021 12:49
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.

Dialogs move to lower right each time they are opened
3 participants