Repository navigation
Dialogs move by their title bar instead of staying pinned to the centre - #1252
Merged
Merged
Conversation
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.
Fixes #1250.
Every dialog is drawn by the same
egui::Windowindialogs::show, placed with.anchor(CENTER_CENTER, (0, -40)). In egui an anchored window is not movable, so Find and Replace couldn't be dragged off the cells it is searching, and neither could Go To, Format Cells, Sort or any other dialog, since they all go through that one window. The window now opens at the same spot with.pivot(CENTER_CENTER).default_pos(...), so the title bar drags it like Excel's and it stays where it is dropped while it is open. Since the position is kept per dialog id, a dialog reopened later in the session comes back where it was last left, which is also what Excel does; happy to reset it on each open if you prefer it always centred.Validation:
crates/ui-egui/tests/dialog_move.rs: drags the Find and Replace title bar by (+120, +80) and checks the window is still offset by exactly that after ten more frames; a second test does the same for Go To, Format Cells and Sort. Both fail on main (the window doesn't move, offset[0 0]) and pass here; swappingdefault_posforfixed_posmakes them fail again.cargo test -p gridcraft-ui-egui --test dialog_move --test zoom_dialog --test popup_dismissal --test protect_password --test committed_text_fieldscargo clippy -p gridcraft-ui-egui --all-targets -- -D warnings,cargo fmt --all -- --checkdocs/ui-parity.mdupdated (Dialogs section, revision history)