Skip to content

Dialogs move by their title bar instead of staying pinned to the centre - #1252

Merged
aiongg merged 1 commit into
storytold:mainfrom
marcoarnulfo:fix/find-replace-movable
Oct 22, 2026
Merged

aiongg merged 1 commit into
storytold:mainfrom
marcoarnulfo:fix/find-replace-movable

Conversation

@marcoarnulfo

Copy link
Copy Markdown
Contributor

Fixes #1250.

Every dialog is drawn by the same egui::Window in dialogs::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; swapping default_pos for fixed_pos makes them fail again.
  • cargo test -p gridcraft-ui-egui --test dialog_move --test zoom_dialog --test popup_dismissal --test protect_password --test committed_text_fields
  • cargo clippy -p gridcraft-ui-egui --all-targets -- -D warnings, cargo fmt --all -- --check
  • docs/ui-parity.md updated (Dialogs section, revision history)
  • (macOS, Apple silicon)

@aiongg
aiongg merged commit 5b2a67c into storytold:main Oct 22, 2026
1 check passed
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.

Find and replace

2 participants