mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-09 12:38:12 +08:00
Remove serde from Bezier-rs web demos to reduce Wasm size
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
use bezier_rs::{Cap, Join};
|
||||
use glam::DVec2;
|
||||
use js_sys::Array;
|
||||
use wasm_bindgen::{JsCast, JsValue};
|
||||
|
||||
pub fn parse_join(join: i32, miter_limit: f64) -> Join {
|
||||
match join {
|
||||
@@ -17,3 +20,10 @@ pub fn parse_cap(cap: i32) -> Cap {
|
||||
_ => panic!("Unexpected Cap value: '{cap}'"),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_point(js_point: &JsValue) -> DVec2 {
|
||||
let point = js_point.to_owned().dyn_into::<Array>().unwrap();
|
||||
let x = point.get(0).as_f64().unwrap();
|
||||
let y = point.get(1).as_f64().unwrap();
|
||||
DVec2::new(x, y)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user