fix(web): restore wasm build broken by SECTION + file association

The v0.7.0 web (GitHub Pages) release failed to compile under
--no-default-features. Two symbols leaked into the wasm build:

* `solid_section` (SECTION command) used truck-meshalgo directly
  (`triangulation`/`extract_interference`), but that crate is gated
  behind the `solid3d` feature which is off on wasm. Gate the function
  with `#[cfg(feature = "solid3d")]` and add a stub for builds without
  it, mirroring `solid_model::boolean`.
* `register_as_handler` was `#[cfg(not(wasm32))]` while its caller
  `set_default_app_blocking` was not, so wasm couldn't resolve it. Drop
  the wasm gate; the existing non-win/lin/mac arm already returns `Ok`
  on wasm, matching `unregister_handler`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-29 17:13:17 +03:00
1 parent da76918320
commit ea35479dd9
2 files changed
+9 -1

No files matched your search

+9
View File
@@ -469,6 +469,7 @@ impl super::OpenCADStudio {
/// SECTION — draw the cross-section outline where an axis-aligned plane
/// (X/Y/Z = `axis` at `value`) cuts the one selected solid, as Line entities.
/// Reuses the mesh-interference analyzer to find the cut segments.
#[cfg(feature = "solid3d")]
pub(super) fn solid_section(&mut self, axis: usize, value: f64) -> Task<Message> {
use acadrust::types::Vector3;
use acadrust::Line;
@@ -576,6 +577,14 @@ impl super::OpenCADStudio {
Task::none()
}
/// Without `solid3d` (e.g. wasm) there is no mesh-interference kernel.
#[cfg(not(feature = "solid3d"))]
pub(super) fn solid_section(&mut self, _axis: usize, _value: f64) -> Task<Message> {
self.command_line
.push_error("SECTION: solid modelling is unavailable in this build.");
Task::none()
}
/// PYRAMID — create an `n`-sided pyramid (regular polygon base of the given
/// circumradius, apex at `height`) as a tessellated mesh, reusing the same
/// face→Shell→mesh path as LOFT. Each face is independent, so no closed-shell
-1
View File
@@ -37,7 +37,6 @@ const APP_ID: &str = "io.github.HakanSeven12.OpenCadStudio";
/// Idempotent and best-effort; safe to call on every launch. Runs synchronously
/// (registry / small file writes), so callers should invoke it off the UI
/// thread.
#[cfg(not(target_arch = "wasm32"))]
pub fn register_as_handler() -> Result<(), String> {
#[cfg(target_os = "windows")]
{