Skip to content

Web: let Canvas and Decal pick PNG and JPEG images (#4048) - #4054

Closed
raykholo wants to merge 2 commits into
tangency-labs:mainfrom
raykholo:web-image-pick
Closed

raykholo wants to merge 2 commits into
tangency-labs:mainfrom
raykholo:web-image-pick

Conversation

@raykholo

@raykholo raykholo commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4048

Canvas and Decal requested image extensions, but the web picker sent those requests to the general files panel and immediately returned no file. The image insertion tool never received a path.

Route PNG/JPEG requests to a browser file input with the requested image filter. Read the selected image into the virtual filesystem and return its upload path to the existing insertion continuation. Cancellation returns no path, read errors appear in the existing status message, and the canvas byte limit is checked before reading.

Design opening keeps its existing picker and file-handle behavior. The default design filters in disk.rs and files.rs are untouched, avoiding the .zip filter changes in #4020.

Two regression tests in the existing disk test module cover PNG/JPEG routing and keeping design/model filters out of the image picker. The image-routing test failed before enabling the fix; all 11 disk tests pass afterward.

Validation

  • cargo fmt --all --check
  • cargo +stable test --profile ci -p solidcraft-web --bin solidcraft-web -- disk::tests: 11 passed.
  • cargo +stable clippy -p solidcraft-web --all-targets -- -D warnings: passed.
  • cargo +stable clippy -p solidcraft-web --target wasm32-unknown-unknown --all-targets --no-deps -- -D warnings -A clippy::useless_conversion: passed. Unmodified wasm clippy reports existing drop_non_drop in crates/io/src/safe_write.rs:162 and useless_conversion in apps/solidcraft-web/src/install.rs:26,28.
  • Browser check (release build with trunk build --release, headless Chromium on Linux x86_64, driven with real pointer input; the image is a generated 64×64 gradient PNG):
    • Insert ▸ Canvas opens a file chooser filtered to .png,.jpg,.jpeg. After choosing the PNG the Canvas tool starts; clicking the XY plane adds Canvas1 to the design and opens Edit Canvas.
    • Insert ▸ Decal opens the same image chooser. After choosing the PNG, clicking the top face of a 60 × 60 × 20 mm box adds Decal1.
    • File ▸ Open… still calls the browser's showOpenFilePicker (design picker with file handles) and does not open the image chooser.
    • On main, clicking Canvas or Decal opens no file chooser: the Files in this browser panel appears and the tool never starts.

Before (main): clicking Insert ▸ Canvas shows the Files panel; no image can be chosen.

before-canvas

After: the chosen PNG placed as a canvas on the XY plane.

after-canvas

After: the chosen PNG placed as a decal on a box face.

after-decal

Canvas and Decal asked the web picker for image extensions, which went to
the general files panel and returned no file. Route PNG/JPEG requests to a
browser file input, read the image into the virtual filesystem and hand its
path to the insertion continuation.
@raykholo raykholo changed the title Web: Canvas and Decal can pick an image file (#4048) Web: let Canvas and Decal pick PNG and JPEG images Oct 21, 2026
@raykholo
raykholo marked this pull request as ready for review October 21, 2026 07:28
@raykholo raykholo changed the title Web: let Canvas and Decal pick PNG and JPEG images Web: let Canvas and Decal pick PNG and JPEG images (#4048) Oct 21, 2026
@raykholo

Copy link
Copy Markdown
Contributor Author

Superseded by #4635, which gives every non-design file type (Canvas and Decal images included) a real file picker in the browser through one path, and now closes #4048 too.

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.

Canvas insert and canvas file filter extension problem

1 participant