Repository navigation
Fix #1372: Dimension tool - #1788
Conversation
Messhias
left a comment
There was a problem hiding this comment.
cargo xtask ci is unchecked (or incomplete) on this PR body. Run it end to end (fmt, clippy, tests, assets, brands, layers, wasm), tick the box when green, and reply here with the outcome. That is required before any approve from here.
|
Thanks @osamaamin2011 — this is careful work: the recipe on the group, the refresh inside the edit so undo stays in step, and input checked before anything changes. I can't merge it as it stands, though: it differs from the documented tool in more ways than a follow-up commit should paper over, and a few things are new decisions for the project owner. I read the code and the tests; I did not build or run it. Reference: Measure and add dimensions using the Dimension tool and Dimension tool options and settings. Behaviour against the documentation
Not in the documentation: the owner decides, not this PR Code With 1–6 as documented, 10–14 fixed and 7–9 left out (or taken to an issue for the owner), this can land. If you'd like to talk it through, we're on Discord: https://discord.gg/artcraft |
|
Tested this locally on macOS (Mac mini M4), built from this branch with What I tried:
This is exactly what I need for technical drawings. Thanks @osamaamin2011! |
Double-click a dimension (Selection, Direct Selection, Group Selection or
the Dimension tool), or choose Object › Dimensions › Edit Dimension
Text…, to type what the dimension shows instead of its measurement, as
drawings that are not to scale or that need tolerances call for. `<>`
stands for the measured value (`<> ±0.5`, `ok. <>`); an empty field shows
the measurement again. The measurement keeps following the measured art,
so `<>` stays live.
- `Dimension.text` (saved in native files only when set) and
`measured_label()`; `label()` applies the text.
- `dimension.create` and `dimension.update` take `text` (string, or ""
/ null for the measurement); one line of at most 256 characters.
- The Edit Dimension Text dialog shows the measurement, the text field
and a live preview, with Use Measured Value; UI command
`dimension.editText {id?}`.
- Strings translated into every catalog; the new message into every
complete one.
Closes storytold#1916. Builds on storytold#1788 (Dimension tool).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DukHNvUY45rjRnvtz91x33
Messhias
left a comment
There was a problem hiding this comment.
cargo xtask ci is incomplete or unchecked on this PR. Run it end to end (fmt, clippy, tests, assets, brands, layers, wasm), tick the checklist when green, and reply here with the outcome. That is required before any approve from here.
Double-click a dimension (Selection, Direct Selection, Group Selection or
the Dimension tool), or choose Object › Dimensions › Edit Dimension
Text…, to type what the dimension shows instead of its measurement, as
drawings that are not to scale or that need tolerances call for. `<>`
stands for the measured value (`<> ±0.5`, `ok. <>`); an empty field shows
the measurement again. The measurement keeps following the measured art,
so `<>` stays live.
- `Dimension.text` (saved in native files only when set) and
`measured_label()`; `label()` applies the text.
- `dimension.create` and `dimension.update` take `text` (string, or ""
/ null for the measurement); one line of at most 256 characters.
- The Edit Dimension Text dialog shows the measurement, the text field
and a live preview, with Use Measured Value; UI command
`dimension.editText {id?}`.
- Strings translated into every catalog; the new message into every
complete one.
Closes storytold#1916. Builds on storytold#1788 (Dimension tool).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DukHNvUY45rjRnvtz91x33
e0356ce to
92c1300
Compare
|
Thanks @bflatastic for the careful review. Rebased on today's main and reworked in 92c1300;
@Messhias: the checklist is ticked with the run above. |
…ngth, angle, radius and diameter annotations
…ns; Properties section; review fixes Drag out from a segment, corner, circle or arc to place a dimension; plain clicks pick two points or two lines. Radial dimensions on perfect arcs, picas, Away/Between and Left/Center/Right text placement. The Properties panel edits a selected dimension, with Apply to All (dimension.applyToAll) and Set as Default. Dimension Selected Paths, the Arc/R/Ø prefixes and the custom defaults are left out. The refresh returns at once in documents without dimensions (Document::dimensions); a linked dimension moved on its own keeps its place; modes, units, line types, arrows and text placement are enums; the tool has its own icon.
…t know still opens; commands still refuse unknown options
92c1300 to
7217dcd
Compare
|
Thanks @osamaamin2011, the rework follows the documented tool closely. Merged after a full gate. One commit of ours on top: the saved dimension data no longer refuses unknown fields, so a file from a later version that adds a dimension option still opens. Commands and tool options still refuse unknown keys ( |


What and why
Closes #1372. Adds the Dimension tool (Modify section of the toolbar) for linked measurement
annotations, following the documented tool:
points (anchors snap, Shift constrains to 45°), then click to place. A curved segment is measured
end to end.
straight lines, then click to place.
radius, inwards the diameter; a click gives the radius. Ellipses are refused.
points, picas, pixels, plus centimetres, metres, feet and yards — precision, scale
(
drawing:real), dimension and extension lines, arrows, and the text: font, size, colour,Position (Away from the Line / Between Line and Object) and Alignment (Left / Center /
Right along the line). Save sets the style of new dimensions.
position and alignment, with Apply to All (
dimension.applyToAll) and Set as Default.A dimension is an ordinary group whose recipe lives in
NodeExtras(the node'sdimensionfield).Linked dimensions follow their art through moves, scaling and anchor/handle edits: they refresh
inside
Session::edit, before Shaper, so they share the edit's undo step. Deleting the art, orchanging its topology, removes its dimensions in the same step. Pasted dimensions keep their
geometry and drop their links. Exports see plain paths and text.
Commands:
dimension.create,dimension.update,dimension.applyToAll, plustool.setOption {tool: "dimension"}and thedimensionOptionsdialog. Docs:docs/dimensions.md.Strings are translated in every complete catalogue; the PR also adds my entry to
contributors/people.toml.How it was tested
crates/engine/tests/dimensions.rs(16 tests): the drag gesture on a segment (and Escapecancelling it), two clicked points then a placing click, dragging out from a rectangle's corner,
radius and diameter by dragging out of and into a circle; arcs and non-arcs; picas; Apply to All
in one undo step; a linked dimension moved on its own keeping its place, and moved with its art
keeping its distance; documents without dimensions skipping the refresh; length, scale, live
edits, undo/redo and file round trips; bad input rejected without changing the document.
dialogs::dimensiontests: the options dialog and the Properties section.cargo xtask ciend to end (92c1300, Windows 11): all 7 steps passed.rectangle, and the Properties section, checked in a screenshot.
Checklist
cargo xtask cipasses: all 7 steps (fmt, clippy, test, assets, brands, layers, wasm) on 92c1300, Windows 11.from Adobe products or GPL/AGPL code.
ASSETS.md(assets/icons/dc-dimension.svg, original).