With the wasm bundle building, get it rendering in a browser:
- Enable iced `webgl` so wgpu uses WebGL2 where WebGPU is absent
(e.g. Firefox by default), and `fira-sans` so UI text has an
embedded font (the web has no system fonts) — without it every
label was blank.
- Replace `std::time::Instant` with `iced::time::Instant` (web-safe);
`Instant::now()` panics ("time not implemented") on wasm and crashed
at boot via the command line.
- Skip the batched-hatch pipeline on wasm: its bind group needs
vertex-stage storage buffers, which WebGL2 lacks (validation error
on "New drawing"). Fields become Option; upload/draw guard on them.
Hatches don't draw on the web for now; everything else does.
- Fix the trunk feature flag (`data-cargo-no-default-features`) and
ignore the `dist/` build output.
Native build + 75 tests unchanged.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
19 lines
792 B
TOML
19 lines
792 B
TOML
# Trunk config for the web (wasm) build of Open CAD Studio (issue #45).
|
|
#
|
|
# Build: trunk build --release
|
|
# Dev: trunk serve
|
|
#
|
|
# Requires: rustup target add wasm32-unknown-unknown
|
|
# cargo install trunk wasm-bindgen-cli
|
|
|
|
[build]
|
|
target = "index.html"
|
|
# Note: the `solid3d` feature is disabled via `data-cargo-no-default-features`
|
|
# on the rust <link> in index.html (truck-meshalgo → lzma-sys C deps cannot
|
|
# cross-compile to wasm).
|
|
|
|
[serve]
|
|
# Cross-origin isolation headers enable SharedArrayBuffer, which wasm threads
|
|
# (rayon) need. GitHub Pages cannot set these; a self-hosted server (e.g. the
|
|
# Open-AEC host) can. Without them the app still runs single-threaded.
|
|
headers = { "Cross-Origin-Opener-Policy" = "same-origin", "Cross-Origin-Embedder-Policy" = "require-corp" }
|