Skip to content

Drawing views: moving a view on its sheet is one rule in the drawing, ready for a drag preview (#4816) - #17645

Merged
bherbruck merged 1 commit into
tangency-labs:drawingsfrom
CamWight:view-move-in-doc-4816
Nov 16, 2026
Merged

bherbruck merged 1 commit into
tangency-labs:drawingsfrom
CamWight:view-move-in-doc-4816

Conversation

@CamWight

Copy link
Copy Markdown
Contributor

Change

This is a cleanup in SolidCraft's drawing code, ahead of a drag preview on the sheet. A user sees no change.

Moving a view on a drawing sheet used to be split between two layers:

  • the saved drawing worked out the new place;
  • the engine wrote it, walked the views lined up with it, gave the view a letter when it was placed apart, and
    shifted a group of views onto another sheet.

A drag preview would have had to repeat the engine's part. Now the drawing's view module holds the whole rule:

  • Drawing::move_view moves a view across its sheet, writes it, gives it its letter when the move places it
    apart, and answers which views moved. drawing.view.move, and drawing.view.move_to_sheet on the view's own
    sheet, both call it. A preview can run it on a copy.
  • Drawing::places_beside gives a view placed apart at a point, and the views lined up with it, their places
    beside it. Moving or copying to another sheet uses it.
  • Drawing::lined_up_with and with_projected share one walk down a view's chains. It uses ViewKind::parent(),
    so projected and section views follow the same rule.

The engine's drag, lined_up, descendants and shifted go. Behaviour is unchanged, except that a copied base
view is now placed exactly at the asked position.

This is stacked on #17620, whose commit is the first one here. Once #17620 lands, this PR is rebased and that
commit drops out. Part of #4816.

Changes a default: no

Validation

On drawings e069e4e, in --profile ci:

  • cargo test -p solidcraft-doc --lib -- drawing::view: 28 passed. This includes four line-up tests on a plain
    drawing, and a check that a view moved apart gets its letter from move_view.

  • cargo test -p solidcraft-engine --lib, the view command, schema and view tests, plus
    hostile_params_never_panic and registry_is_consistent: 129 passed.

  • 4 planted faults, each caught by its named test:

    • no letter on a move apart;
    • break_alignment ignored;
    • a view moved to another sheet gets no letter;
    • the line-up placed apart left behind.

    The clean run after them passes.

  • rustfmt --check, cargo clippy -p solidcraft-doc -p solidcraft-engine --all-targets -- -D warnings, and
    cargo check -p solidcraft-doc -p solidcraft-engine --target wasm32-unknown-unknown: all clean.

Screenshots of the behavior (when observable)

None: nothing changes on screen. A view moved apart already showed its letter after the command; the letter now
comes from the same call a preview will use.

Integration status

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@github-actions github-actions Bot added the area:doc timeline, components, parameters, naming label Nov 16, 2026
@CamWight
CamWight marked this pull request as ready for review November 16, 2026 03:53
…th it go too (tangency-labs#4816)

Where a view sits was split between the record and the engine: the record read, checked and
mapped a drag to a place, and the engine wrote it, walked the views lined up with it and shifted a
group onto another sheet. The drag preview the sheet page will get would have had to repeat the
engine's write.

Now the record's view module holds the whole rule:
- Drawing::move_view moves a view across its sheet, writes it, and answers the views that moved
  (it, then the views lined up with it whose centres changed). drawing.view.move and
  drawing.view.move_to_sheet on the view's own sheet call it, and a preview can run it on a copy.
- Drawing::places_beside gives a view placed apart at a point and the views lined up with it,
  each kept beside it. move_to_sheet and copy_to_sheet use it for another sheet.
- Drawing::lined_up_with and with_projected share one walk down a view's chains.

The engine's drag, lined_up, descendants and shifted go, with shifted's arm for a base view
lined up with nothing, which the record refuses. Behaviour is unchanged, except that a copied
view is now placed exactly at the asked position. The line-up rules get tests of their own on a
plain drawing.

A view the move places apart is given its letter inside the same doc call, so the drag and its preview show the same label.

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

Copy link
Copy Markdown
Contributor Author

Rebased onto drawings after #13045, #13033 and this PR's base, #17620, which merged this morning. The head is now b8f5acf, this PR's own commit alone on the new drawings.

  • Drawings had added the pictorial, auxiliary and flat arms to the engine's shifted. This PR deletes shifted: moving a view and its line-up is now Drawing::move_view and Drawing::places_beside in the doc crate. Those match only a projected view's lined-up place, and every other kind is placed at a point, so the new kinds need nothing there.
  • Checked: the drawing view and schema tests (engine) and the drawing::view doc tests pass, and fmt and clippy are clean. Three planted faults in the move rules are caught: alignment not broken, the wrong views reported as moved, and the line-up left behind.

@CamWight
CamWight force-pushed the view-move-in-doc-4816 branch from f3db82b to b8f5acf Compare November 16, 2026 10:17
@bherbruck
bherbruck merged commit dbf2874 into tangency-labs:drawings Nov 16, 2026
30 checks passed
@CamWight
CamWight deleted the view-move-in-doc-4816 branch November 16, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:doc timeline, components, parameters, naming

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants