Crop assists and compare panel (#36) #85
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
needs-info
needs-triage
question
ready-for-agent
ready-for-human
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crowmaki/ai-studio!85
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-36-crop-assists"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #36. Part of #24.
What
studio-core(crop_assist.rs), all on the sheet's original pixels and writing nothing:analyze_source_sheetfinds the figures: blobs of pixels that differ from the background (estimated from the sheet's edge; handles light, dark, noisy and transparent backgrounds). Dust is dropped and pieces that nearly touch (a head apart from its body) join into one figure.auto_fitis empty, so the Tiles stay unboxed. The other figures are the snap targets.shrink_to_contentshrinks a box to the content inside it; an empty box is returned as it is.src-tauri:analyze_source_sheetandshrink_to_contentcommands (run off the async runtime) with DTOs.bindings.tsregenerated.assist.ts:snapMove,snapResize); hold Alt to turn it off.ComparePanelside panel: per Tile, the current version beside the new crop in the 4:9 cell with sizes, the new / changed / unchanged status from Rust, and an Include checkbox to skip Tiles before commit.assist.ts, since they need no pixels. Finding figures and shrinking read pixels, so they are in Rust (ADR-0003).Tests
crates/studio-core/tests/crop_assist.rs(16 tests): reading order on 2x2 and 1x4 layouts, a short face staying in its row, auto-fit roles, the four largest with extra figures left as snap targets, fewer than four leaving Tiles unboxed, a blank sheet, fragment merging, noisy / transparent / dark backgrounds, an unknown sheet, shrink cases, and re-committing an auto-fit making versions only for the crops that moved.src/lib/references/assist.test.ts(16 tests): presets, padding, snap targets, snapping on resize and move.src-tauri/tests/source_sheets.rs: the two commands through the adapter.Checks
cargo test --workspace --all-features,bun run testandbun run checkpass.cargo clippy --workspace --all-targets --all-features -- -D warningspasses except atype_complexitylint onHooks::open_windowthat is already on main.Open questions