diff --git a/crates/ui-egui/src/tile_overlay.rs b/crates/ui-egui/src/tile_overlay.rs index 03d8156dde..731ddc06b8 100644 --- a/crates/ui-egui/src/tile_overlay.rs +++ b/crates/ui-egui/src/tile_overlay.rs @@ -21,6 +21,7 @@ use std::sync::Arc; use egui::{Align2, Color32, FontId, Painter, Shape, Stroke}; use photocraft_geom::{Rect as DRect, TILE_SIZE, TileCoord}; use photocraft_raster::{Surface, Tile}; +#[cfg(not(target_arch = "wasm32"))] use rayon::prelude::*; use crate::PhotocraftApp; @@ -70,11 +71,18 @@ pub fn tile_infos(s: &Surface, parallel: bool) -> Vec { by_ptr.entry(ptr(t)).or_insert(t); } let distinct: Vec<(usize, &Arc)> = by_ptr.into_iter().collect(); + // rayon is a native-only dependency; the web build hashes serially. + #[cfg(not(target_arch = "wasm32"))] let hashed: Vec<(usize, u64)> = if parallel { distinct.par_iter().map(|(p, t)| (*p, content_hash(t))).collect() } else { distinct.iter().map(|(p, t)| (*p, content_hash(t))).collect() }; + #[cfg(target_arch = "wasm32")] + let hashed: Vec<(usize, u64)> = { + let _ = parallel; + distinct.iter().map(|(p, t)| (*p, content_hash(t))).collect() + }; let hash_of: HashMap = hashed.into_iter().collect(); let mut count: HashMap = HashMap::new(); for (_, t) in s.tiles() {