Skip to content

Commit

Permalink
fix get_parameter_bool_array on web
Browse files Browse the repository at this point in the history
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
  • Loading branch information
sagudev committed Oct 9, 2024
1 parent 94f45bc commit 3d6e52a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3378,12 +3378,10 @@ impl HasContext for Context {
.unwrap();
use wasm_bindgen::JsCast;
let mut v = [false; N];
if let Some(value) = value.as_bool() {
v[0] = value;
} else if let Some(values) = value.dyn_ref::<js_sys::Array>() {
for (i, val) in values.values().into_iter().enumerate() {
v[i] = val.unwrap().as_bool().unwrap_or_default();
}
if let Some(values) = value.dyn_ref::<js_sys::Array>() {
v.iter_mut()
.zip(values.values())
.for_each(|(v, val)| *v = val.unwrap().as_bool().unwrap_or_default())
}
v
}
Expand Down

0 comments on commit 3d6e52a

Please sign in to comment.