Skip to content

Offset Path's Preview checkbox keeps its last state across opens (#3195) - #3203

Merged
bflatastic merged 1 commit into
storytold:mainfrom
rahul05ranjan:fix/offset-path-preview-memory
Oct 21, 2026
Merged

bflatastic merged 1 commit into
storytold:mainfrom
rahul05ranjan:fix/offset-path-preview-memory

Conversation

@rahul05ranjan

@rahul05ranjan rahul05ranjan commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What's wrong

Offset Path remembers the values it was last confirmed with (#1152 — offset, joins, miterLimit are kept in app.ui.offset_path on OK), but the Preview checkbox is not among the kept fields. So every time the dialog opens — including for the next object — Preview starts unchecked (d.bool("preview") defaults to false when the field is absent), and it has to be ticked by hand every time (#3195).

Simplify's "Open this dialog with these settings next time" already keeps its preview field among SIMPLIFY_KEPT; Offset Path was the odd one out.

What the fix does

preview joins the fields Offset Path keeps on OK:

let kept = ["offset", "joins", "miterLimit", "preview"].into_iter()...

That is the whole change. Unchanged behaviour:

  • A very first open (nothing confirmed yet) still starts unchecked.
  • Cancel keeps nothing, as before.
  • Turning Preview off before OK stores false, so an unchecked state is remembered too.

Verification

A regression test next to the existing offset_path_remembers_its_last_values (same harness, same shape):

#[test]
fn offset_path_remembers_its_last_preview_state() {
    // open, assert unchecked on a first open, tick Preview, confirm,
    // reopen, assert the checkbox is still on
}

I traced the flow on current main end to end (menus.rs:3390 opens on app.ui.offset_path when it is an object; form::preview_result writes the checkbox into d.fields["preview"]; Dialog::bool defaults to false), and the new test mirrors offset_path_remembers_its_last_values line by line — but I had no Rust toolchain on the machine I worked from, so I could not execute cargo test here. Flagging that plainly; happy to adjust if CI finds anything.

Fixes #3195

Summary by CodeRabbit

  • Bug Fixes

    • The Offset Path dialog now preserves the Preview checkbox setting when reopened.
  • Tests

    • Added coverage to verify the Preview setting is initially unchecked and remains enabled after being saved and reopened.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 549e685b-2a6e-4d6d-81b8-e689607c8912
📥 Commits

Reviewing files that changed from the base of the PR and between 9e7929e and c79e98f.

📒 Files selected for processing: 2
  • crates/ui-egui/src/dialogs/path_ops.rs
  • crates/ui-egui/src/dialogs/tests_modal.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

📝 Walkthrough

The Offset Path dialog now retains the Preview checkbox state when reopened. A regression test verifies the unchecked default and confirms that an enabled state persists after confirmation and reopening.

Changes: Offset Path Preview State

Layer / File(s) Summary
Save and test Preview state
crates/ui-egui/src/dialogs/path_ops.rs, crates/ui-egui/src/dialogs/tests_modal.rs
The dialog retains the Preview checkbox state alongside the other Offset Path settings. The regression test checks the default unchecked state and verifies that an enabled state persists after reopening.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: bflatastic

Merge Risk: ⚪ Minimal · up to c79e9

The Preview preference now retains its confirmed state across dialog openings, including when switching objects, while first opens remain unchecked.

Architecture risk: 🔵 Low · up to c79e9

The change affects 1 system.

Changed systems: crates

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/ui-egui/src/dialogs/path_ops.rs: Offset Path settings retained across dialog opens now include the preview checkbox state in addition to offset, join, and miter-limit values.
  • observed — Modified behavior in crates/ui-egui/src/dialogs/tests_modal.rs: Added offset_path_remembers_its_last_preview_state, which checks the default unchecked state, confirms the dialog with preview enabled, then verifies the enabled state is restored on reopening.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: preserving the Offset Path Preview checkbox state across dialog openings.
Description check Passed The description clearly explains the problem, the fix, expected behavior, linked issue, and regression test. It also states that cargo test was not run. The repository checklist is not included, but t…
Linked Issues check Passed Issue [#3195] requires Offset Path to remember the Preview state during the session, including later opens for another object. path_ops.rs now includes preview in the fields copied to `app.ui.offs…
Out of Scope Changes check Passed The changes are limited to the Offset Path retained-field list and one focused regression test in tests_modal.rs. Both changes directly support issue [#3195]. No unrelated product behavior or unrela…
Full details: Description check

Explanation

The description clearly explains the problem, the fix, expected behavior, linked issue, and regression test. It also states that cargo test was not run. The repository checklist is not included, but the description is otherwise mostly complete and relevant.

Full details: Linked Issues check

Explanation

Issue [#3195] requires Offset Path to remember the Preview state during the session, including later opens for another object. path_ops.rs now includes preview in the fields copied to app.ui.offset_path after confirmation. The existing dialog-open flow reads this shared state. The new offset_path_remembers_its_last_preview_state test verifies an initial unchecked state and persistence after confirmation. The implementation also stores false when that field is unchecked.

Full details: Out of Scope Changes check

Explanation

The changes are limited to the Offset Path retained-field list and one focused regression test in tests_modal.rs. Both changes directly support issue [#3195]. No unrelated product behavior or unrelated files are changed.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Messhias Messhias left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

…rytold#3195)

The Offset Path dialog remembers the values it was last confirmed
with (storytold#1152), but the Preview checkbox was not among the kept
fields, so every open started unchecked and Preview had to be
ticked manually each time. Preview now rides along with offset,
joins and miterLimit in the fields kept on OK, as Simplify's
retained fields already keep theirs.

Unchanged: a very first open (nothing kept yet) still starts
unchecked, and Cancel keeps nothing.

Adds a regression test beside offset_path_remembers_its_last_values:
open, tick Preview, confirm, reopen - the checkbox is still on.

Verified by reading the flow on current main (menus.rs opens on
app.ui.offset_path when it is an object, d.bool("preview") defaults
to false when the field is absent, form::preview_result ticks the
checkbox into d.fields) and by tracing the existing storytold#1152 test;
no Rust toolchain on this machine, so the test was not executed
here - saying so plainly for the reviewer.

Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
@bflatastic
bflatastic force-pushed the fix/offset-path-preview-memory branch from c79e98f to 9ce5ffd Compare October 21, 2026 08:41
@bflatastic
bflatastic merged commit c5f6443 into storytold:main Oct 21, 2026
1 check was pending
@bflatastic

Copy link
Copy Markdown
Member

Merged, thanks @rahul05ranjan! Offset Path's Preview checkbox keeps its last state across opens (#3195). If you'd like to talk about what's next, we're on Discord: 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.

Offset Path: remember the Preview checkbox between uses

3 participants