1use js_sys::Object;
2use wasm_bindgen::prelude::*;
3
4use crate::{Layer, LayerOptions, create_object_with_properties};
5
6#[wasm_bindgen]
7extern "C" {
8 #[wasm_bindgen(extends = Layer)]
10 #[derive(Debug, Clone)]
11 pub type Path;
12
13 #[wasm_bindgen(method)]
15 pub fn redraw(this: &Path);
16
17 #[wasm_bindgen(method, js_name = setStyle)]
19 pub fn set_style(this: &Path, path_options: &PathOptions);
20
21 #[wasm_bindgen(method, js_name = bringToFront)]
23 pub fn bring_to_front(this: &Path);
24
25 #[wasm_bindgen(method, js_name = bringToBack)]
27 pub fn bring_to_back(this: &Path);
28}
29
30create_object_with_properties!(
31 (PathOptions, PathOptions, LayerOptions),
32 (stroke, stroke, bool),
33 (color, color, String),
34 (weight, weight, f64),
35 (interactive, interactive, bool),
36 (opacity, opacity, f64),
37 (line_cap, lineCap, String),
38 (line_join, lineJoin, String),
39 (dash_array, dashArray, String),
40 (dash_offset, dashOffset, String),
41 (fill, fill, bool),
42 (fill_color, fillColor, String),
43 (fill_opacity, fillOpacity, f64),
44 (fill_rule, fillRule, String),
45 (bubbling_mouse_events, bubblingMouseEvents, bool),
46 (renderer, renderer, JsValue),
47 (class_name, className, String)
48);
49
50impl Default for PathOptions {
51 fn default() -> Self {
52 PathOptions::new()
53 }
54}