Skip to content

Fix #1876: Artboard Options has X and Y with a reference point - #2739

Merged
bflatastic merged 1 commit into
storytold:mainfrom
guillehr2:fix/1876-artboard-options-xy
Oct 17, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
guillehr2:fix/1876-artboard-options-xy

Conversation

@guillehr2

Copy link
Copy Markdown
Contributor

What and why

Fixes #1876. The reporter needs to adjust an artboard precisely. #2032 made the Artboards panel's options icon and menu open Artboard Options, but the dialog only has Name, Width and Height. The generic form (dialogs/form.rs) hides x and y for every dialog, because in the shape dialogs they are the click position. So an artboard's position could be dragged but not typed.

Artboard Options now shows X and Y after Width and Height, in the same grid, with the reference point locator before X:

  • What X and Y show. They are where the reference point lies, counted from the ruler origin (Feature Request: Ability to customize and reset the ruler origin (Zero Point) #1212). These are the values the Transform panel and the Control bar show for the artboard with the Artboard tool.
  • One shared reference point. The locator is the one the Transform panel, the Control bar and Properties share, so choosing a point in the dialog also changes it in those panels.
  • Typing a position. A typed X or Y moves the artboard so that its reference point lands there. This uses the same panels::transform::artboard_rect as the panels.
  • Changing the size. A new Width or Height keeps the reference point in place, as the panels' W and H do. With the default center point the artboard grows about its center. With Top Left it grows from its top-left corner, as every size typed in the dialog did before.
  • What OK sends is unchanged. The fields still hold the top-left corner in document points, so confirm doesn't change:
    • OK runs artboard.setProps (artboard.new for Alt-click on New Artboard) in one undo step.
    • Move Artwork with Artboard still applies.
    • Setting the fields over the control channel or MCP works as before.
  • New artboards. Alt-click on New Artboard (ui.newArtboard) gets the same rows, so a new artboard's position can be typed too.
  • The shape dialogs don't change. form::grid still hides their x and y. The new form::grid_then lets a dialog add rows to the generic grid, so the labels and fields line up.

Public references:

Docs:

  • docs/target-app-parity.md: an evidence line under the artboards, the status line and the revision history. Scores unchanged.
  • docs/ui-parity.md: a row in the artboards section, the status line and the revision history.
  • docs/mcp.md: the dialog's x and y are the top-left corner in document points, while the dialog shows X and Y at the reference point, counted from the ruler origin.

How it was tested

New headless pointer and key tests in crates/ui-egui/src/dialogs/tests.rs, on a 400 × 300 pt artboard with the ruler origin at (120, 50):

  • artboard_options_x_and_y_count_from_the_ruler_origin_at_the_reference_point:
    • At the default center point the dialog shows X 80 pt and Y 100 pt.
    • After a click on the locator's Bottom Right it shows 280 pt and 250 pt.
    • Typing X 300 and Y 0, then Enter, puts the artboard at (20, −250)–(420, 50) in one undo step, and Undo restores it.
    • A Rectangle dialog still shows no X and Y.
  • artboard_options_size_keeps_the_reference_point:
    • Width 500 at the center point keeps X at 80 pt and gives (−50, 0)–(450, 300).
    • With Top Left it gives (0, 0)–(500, 300).

Both fail on main (the dialog has no X). With only the size part of the change reverted, the second fails (X reads 130 pt) and the first passes. Frames::button now goes through a new Frames::control(label, role), which also finds the locator's squares.

Checks, on main at f7de3d6:

  • cargo fmt --all -- --check.
  • cargo clippy -p vectorcraft-ui-egui --all-targets -- -D warnings.
  • cargo test -p vectorcraft-ui-egui --lib dialogs::tests: 166 passed.
  • cargo test -p vectorcraft-ui-egui: 1583 passed on the earlier base, 8c10185. Rebasing onto f7de3d6 conflicted only in docs/target-app-parity.md.

Screenshots from the headless egui_kittest (wgpu) harness, drawn the way dialogs/save_options.rs and panels/image_trace.rs draw theirs: Medium Dark, the same 400 × 300 pt artboard and ruler origin. The capture code was a local test and isn't in this PR.

Before / after:

Before After
Artboard Options before Artboard Options after

Merging with open PRs

Not in this PR

  • Properties. Edit Artboards in Properties shows the X and Y of the artboard's top-left corner, with no locator. The Transform panel and the Control bar use the reference point, and so does this dialog, which has the locator. Making Properties match them is a separate change.
  • Artboard rulers. With artboard rulers (a new document's), the ruler origin is the active artboard's corner. So the active artboard's own X and Y count from its own corner, here as in the Transform panel and the Control bar: at Top Left they read 0, 0, and a typed value moves the artboard by that much. Whether artboard positions should count from the global rulers is a question for all three.

Checklist

  • cargo xtask ci passes (fmt, clippy, tests, assets, brands, layers, wasm). Not the full run: fmt, and clippy and the tests of the changed crate (vectorcraft-ui-egui), were run locally.
  • No panics in shipped code: no unwrap(), expect(), panic!, unreachable!, todo! or
    unimplemented! outside tests, and no unchecked indexing on data from files, parameters or
    messages. Errors are returned as Result and shown to the user
    (why and how).
  • Clean-room: nothing copied from Adobe products or GPL/AGPL code (AGENTS.md).
  • Every new asset has a row in ASSETS.md. (No new assets.)

Artboard Options showed Name, Width and Height only: the generic form
hides x and y, which in the shape dialogs are the click position. The
artboard's position could be dragged but not typed.

The dialog now draws its own rows after the form's, in the same grid:
the reference point locator the Transform panel, the Control bar and
Properties share, then X and Y. They show where the reference point
lies, counted from the ruler origin (storytold#1212), as the Transform panel and
the Control bar show an artboard's position. A typed X or Y moves the
artboard so that its reference point lands there, and a new Width or
Height keeps the reference point in place. The fields still hold the
top-left corner in document points, so OK runs artboard.setProps as
before, in one undo step. The shape dialogs keep their x and y hidden.

form::grid_then lets a dialog add rows to the generic grid.
@bflatastic
bflatastic force-pushed the fix/1876-artboard-options-xy branch from 6d39ee5 to 2a5dfa6 Compare October 17, 2026 18:48
@bflatastic
bflatastic merged commit 079cd49 into storytold:main Oct 17, 2026
@bflatastic

Copy link
Copy Markdown
Member

Thanks @guillehr2, merged. It went through the full gate (fmt, clippy, tests, layers, wasm) in today's batch. If you're not on our Discord yet, come join us: https://discord.gg/artcraft

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 Report] [VectorCraft] I cannot edit the artboard size and dimension.

2 participants