fix(wasm): make the web build actually run in the browser

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>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-16 17:53:56 +03:00
1 parent f2c4a1736a
commit c49ad887b8
11 files changed
+55 -14

No files matched your search

+2 -2
View File
@@ -1710,7 +1710,7 @@ impl Scene {
Some([cx - w * margin, cy - h * margin, cx + w * margin, cy + h * margin])
};
let block = self.model_space_block_handle();
let t_tess = std::time::Instant::now();
let t_tess = iced::time::Instant::now();
let arc = Arc::new(self.wires_for_block_culled(block, tess_region, wpp, None, None));
self.last_tess_ms.set(t_tess.elapsed().as_secs_f32() * 1000.0);
self.last_tess_wires.set(arc.len());
@@ -1739,7 +1739,7 @@ impl Scene {
}
}
let layout_block = self.current_layout_block_handle();
let t_tess = std::time::Instant::now();
let t_tess = iced::time::Instant::now();
let mut wires = self.wires_for_block(layout_block);
self.last_tess_ms.set(t_tess.elapsed().as_secs_f32() * 1000.0);
self.last_tess_wires.set(wires.len());