Editor has no default-stitch-type setting — workspace has color simplification + thread library settings, but no setting to set the default stitch type for new paths #198

Closed
opened 2026-10-03 23:50:14 +00:00 by Mark · 1 comment
Owner

Finding

src/components/workspace/SettingsModal.tsx renders two settings sections:

  • ColorSimplificationSection (color count target, similarity threshold, etc.)
  • ThreadLibrarySection (CRUD for the user's thread library)

It does NOT render a "Default Stitch Type" or "Default Path Density" section. A new path drawn in the Editor starts with stitchType: 'satin' (per src/components/editor/constants.ts:57); the user can change it in the right panel after drawing, but the default is hard-coded.

grep -n 'defaultStitch\|stitchType.*default' src/components/editor/ returns 0 hits.

A user who designs 10 paths and wants them all to be fill (not satin) has to:

  1. Draw path 1 (satin default)
  2. Change to fill in the right panel
  3. Draw path 2 (satin default)
  4. Change to fill
  5. ... 6 more times

Or use the bulk select after #188 lands.

Where

  • Settings modal: src/components/workspace/SettingsModal.tsx (2 sections)
  • No default section: grep -n 'Default Stitch' src/components/workspace/SettingsModal.tsx returns 0 hits
  • Hard-coded default: src/components/editor/constants.ts:57 (stitchType: 'satin')
  • AutoDigitizeSettings exists: src/components/workspace/types.ts:208 (could host a defaultStitchType field)

Suggested fix shape

Add a "Path Defaults" section to the Settings modal:

<CollapsibleSection title="Path Defaults">
  <SelectRow
    label="Default stitch type"
    value={settings.defaultStitchType}
    options={['satin', 'fill', 'running', 'cross-stitch', 'zigzag']}
    onChange={(v) => setDefaultStitchType(v)}
  />
  <SliderRow
    label="Default density"
    value={settings.defaultDensity}
    min={0.1} max={1.0} step={0.1}
    onChange={(v) => setDefaultDensity(v)}
  />
</CollapsibleSection>

The settings persist in localStorage (the Settings modal already uses useLocalStorage). The Editor's handleFinishPath reads the default from localStorage when creating a new path.

Severity

Low. The user can change per-path. Power users with many paths of the same type notice.

Discovered by

Gap analysis (2026-10-02) of editor defaults.

  • #125 (open) — Settings modal: add Optional defaults sections. This is the same family of issue, scoped to the editor's path defaults specifically.
  • #188 (open) — Editor multi-path selection. Bulk apply vs per-path default are competing solutions; both are valid.
## Finding `src/components/workspace/SettingsModal.tsx` renders two settings sections: - `ColorSimplificationSection` (color count target, similarity threshold, etc.) - `ThreadLibrarySection` (CRUD for the user's thread library) It does NOT render a "Default Stitch Type" or "Default Path Density" section. A new path drawn in the Editor starts with `stitchType: 'satin'` (per `src/components/editor/constants.ts:57`); the user can change it in the right panel after drawing, but the default is hard-coded. `grep -n 'defaultStitch\|stitchType.*default' src/components/editor/` returns 0 hits. A user who designs 10 paths and wants them all to be fill (not satin) has to: 1. Draw path 1 (satin default) 2. Change to fill in the right panel 3. Draw path 2 (satin default) 4. Change to fill 5. ... 6 more times Or use the bulk select after #188 lands. ## Where - Settings modal: `src/components/workspace/SettingsModal.tsx` (2 sections) - No default section: `grep -n 'Default Stitch' src/components/workspace/SettingsModal.tsx` returns 0 hits - Hard-coded default: `src/components/editor/constants.ts:57` (`stitchType: 'satin'`) - AutoDigitizeSettings exists: `src/components/workspace/types.ts:208` (could host a `defaultStitchType` field) ## Suggested fix shape Add a "Path Defaults" section to the Settings modal: ```tsx <CollapsibleSection title="Path Defaults"> <SelectRow label="Default stitch type" value={settings.defaultStitchType} options={['satin', 'fill', 'running', 'cross-stitch', 'zigzag']} onChange={(v) => setDefaultStitchType(v)} /> <SliderRow label="Default density" value={settings.defaultDensity} min={0.1} max={1.0} step={0.1} onChange={(v) => setDefaultDensity(v)} /> </CollapsibleSection> ``` The settings persist in localStorage (the Settings modal already uses `useLocalStorage`). The Editor's `handleFinishPath` reads the default from localStorage when creating a new path. ## Severity Low. The user can change per-path. Power users with many paths of the same type notice. ## Discovered by Gap analysis (2026-10-02) of editor defaults. ## Related - #125 (open) — Settings modal: add Optional defaults sections. This is the same family of issue, scoped to the editor's path defaults specifically. - #188 (open) — Editor multi-path selection. Bulk apply vs per-path default are competing solutions; both are valid.
Mark closed this issue 2026-10-04 01:21:11 +00:00
Author
Owner

Shipped via commit b556049 (fix(#198): Editor Path Defaults). Closing summary:

  • New src/components/workspace/pathDefaults.ts — versioned localStorage layer (tc_path_defaults_v1) with a usePathDefaults() hook (cross-tab storage event sync, mirrors the useThreadLibrary pattern from #126). Sanitize step clamps density to [0.1, 1.0] and rejects any stitch type that isn't in the editor's user-facing dropdown, so a hand-edited localStorage blob can't leave the Settings select showing a missing <option>.
  • New src/components/workspace/PathDefaultsSection.tsx — collapsible section matching the existing Thread Library / Color Simplification pattern. <select> for default stitch type (5 user-facing options: satin, fill, running, cross-stitch, zigzag) + the editor's same <Slider> for default density (0.1..1.0, step 0.05).
  • SettingsModal renders the new section as a third collapsible in the existing top-level border (default-open, like the other two).
  • Editor.tsx handleFinishPath now reads pathDefaults.defaultStitchType and pathDefaults.defaultDensity from the hook instead of the hard-coded 'satin' / 0.4. Dep array updated to include pathDefaults so a Settings-modal change propagates on the next drawn path.

Tests: 17 in pathDefaults.test.ts (load/save/sanitize/clamp/cross-tab sync) + 4 new in SettingsModal.test.tsx (section renders with in-code baseline, edits persist, persisted defaults reload, malformed payloads sanitize). Full vitest run: 551 passed in workspace + pages after rebase; the 3 pre-existing EditorCanvas (#170) snap-drag failures are unrelated. tsc -b clean, eslint clean.

A power user who designs 10 fill paths can now flip the default once in Settings instead of editing each path in the right panel — and the right-panel per-path controls still override per-path, so existing designs and workflows are unaffected.

Shipped via commit b556049 (`fix(#198): Editor Path Defaults`). Closing summary: - New `src/components/workspace/pathDefaults.ts` — versioned localStorage layer (`tc_path_defaults_v1`) with a `usePathDefaults()` hook (cross-tab `storage` event sync, mirrors the `useThreadLibrary` pattern from #126). Sanitize step clamps density to [0.1, 1.0] and rejects any stitch type that isn't in the editor's user-facing dropdown, so a hand-edited localStorage blob can't leave the Settings select showing a missing `<option>`. - New `src/components/workspace/PathDefaultsSection.tsx` — collapsible section matching the existing Thread Library / Color Simplification pattern. `<select>` for default stitch type (5 user-facing options: satin, fill, running, cross-stitch, zigzag) + the editor's same `<Slider>` for default density (0.1..1.0, step 0.05). - `SettingsModal` renders the new section as a third collapsible in the existing top-level border (default-open, like the other two). - `Editor.tsx` `handleFinishPath` now reads `pathDefaults.defaultStitchType` and `pathDefaults.defaultDensity` from the hook instead of the hard-coded `'satin'` / `0.4`. Dep array updated to include `pathDefaults` so a Settings-modal change propagates on the next drawn path. Tests: 17 in `pathDefaults.test.ts` (load/save/sanitize/clamp/cross-tab sync) + 4 new in `SettingsModal.test.tsx` (section renders with in-code baseline, edits persist, persisted defaults reload, malformed payloads sanitize). Full vitest run: 551 passed in workspace + pages after rebase; the 3 pre-existing `EditorCanvas (#170)` snap-drag failures are unrelated. `tsc -b` clean, eslint clean. A power user who designs 10 fill paths can now flip the default once in Settings instead of editing each path in the right panel — and the right-panel per-path controls still override per-path, so existing designs and workflows are unaffected.
Sign in to join this conversation.
No description provided.