Skip to content

Dialogs: the button row is as wide as the fields, not the window - #239

Merged
bflatastic merged 1 commit into
storytold:mainfrom
theironchef:fix/dialog-width
Oct 7, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
theironchef:fix/dialog-width

Conversation

@theironchef

Copy link
Copy Markdown
Contributor

Fixes #238.

Problem: show in crates/ui-egui/src/dialogs/mod.rs lays out the OK/Cancel row right to left at ui.available_width(). For a dialog without a max_width, that is the whole window, so the row, and the window with it, spans the window. This affects Clean Up, Blend Options, every generic parameter dialog (ui.paramDialog) and the other form dialogs without a maximum width. Clean Up was 1586 points wide in a 1600-point window.

Change: the row is as wide as what the dialog has laid out above it (ui.min_rect().width()), which includes set_min_width. A dialog is now sized to its fields, and wide dialogs keep their size:

  • dialogs that set a large min_width, such as Export for Screens, PDF Presets and Print Presets, are at least that wide;
  • dialogs whose fields take the full room still do.

The comment above the row, which already explained the same issue for its height, now covers its width too.

Tests

  • New dialogs::tests::a_form_dialog_is_as_wide_as_its_fields_not_the_window: the Clean Up parameter dialog in a 1600-point window is narrower than 500 points, and in a 360-point window it still fits.
  • On main it fails ("Clean Up is 1586 wide in a 1600-point window") and passes with this change.
  • cargo test -p vectorcraft-ui-egui: 526 passed.
  • cargo clippy -p vectorcraft-ui-egui --all-targets -- -D warnings (Rust 1.99): clean.
  • cargo fmt --all -- --check: clean.
  • Checked in a release build: Clean Up and Blend Options are compact and centred, and Print Presets and Export for Screens look as before.

I didn't run the full cargo xtask ci (wasm step) here.

🤖 Generated with Claude Code

The OK/Cancel row was laid out right to left at the full available
width, and a dialog without a maximum width may use the whole window:
the row, and the window with it, spanned the window (Clean Up, Blend
Options, every generic parameter dialog). The row now spans the fields
above it, at least the dialog's minimum width, so a dialog is sized to
its content.

Fixes storytold#238.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bflatastic

Copy link
Copy Markdown
Member

Thanks, merged! Dialogs sized to their fields is how the reference app's form dialogs behave. The before/after numbers (Clean Up at 1586 pt in a 1600-pt window) and the narrow-window check in the test made this easy to review. I ran the full cargo xtask ci (wasm included) on it stacked with #237 and #233 on current main, and all 7 steps passed. Thank you for the contribution!

RockCollect0r pushed a commit to RockCollect0r/vectorcraft that referenced this pull request Oct 7, 2026
On the in-window menu bar (Windows and Linux) each top-level menu needed
its own click: with File open, moving the pointer onto Edit or Object did
nothing. Now, as on a native menu bar, while one menu is open a moving
pointer that reaches another title opens that menu instead (ported from
PhotoCraft). A pointer resting on a title doesn't switch, and a tall menu
that covers the bar doesn't switch to the title underneath it. The native
macOS menu bar is unchanged.

Also adds a regression test for storytold#292: the Simplify, Offset Path, Move,
Rotate, Split Into Grid and Average dialogs are 366 pt wide in a 1600 pt
window (already fixed by storytold#239).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Bug: Dialogs without a maximum width (Clean Up, Blend Options…) stretch across the whole window

2 participants