From 6c33db0f98690e3b12cba02db1ce51aa63e9d082 Mon Sep 17 00:00:00 2001 From: LukaOber Date: Sat, 12 Oct 2024 18:55:02 +0200 Subject: [PATCH] added new for ChartResize --- charming/src/renderer/wasm_renderer.rs | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/charming/src/renderer/wasm_renderer.rs b/charming/src/renderer/wasm_renderer.rs index 72de26c..5a2c07d 100644 --- a/charming/src/renderer/wasm_renderer.rs +++ b/charming/src/renderer/wasm_renderer.rs @@ -62,25 +62,36 @@ impl WasmRenderer { } } -#[derive(Serialize)] +#[derive(Clone, Debug, Serialize, Copy)] struct ChartSize { width: u32, height: u32, } -#[derive(Serialize)] +#[derive(Clone, Debug, Serialize, Copy)] pub struct ChartResize { /// New width in px - width: u32, + pub width: u32, /// New height in px - height: u32, + pub height: u32, /// If true, emits events on resize - silent: bool, + pub silent: bool, /// Resize animation options - animation: Option, + pub animation: Option, +} + +impl ChartResize { + pub fn new(width: u32, height: u32, silent: bool, animation: Option) -> Self { + Self { + width, + height, + silent, + animation, + } + } } -#[derive(Serialize)] +#[derive(Clone, Debug, Serialize, Copy)] pub struct Animation { /// duration of the animation pub duration: u32, @@ -90,7 +101,7 @@ pub struct Animation { } /// available easing functions in echarts -#[derive(Clone, Debug, Default, Serialize)] +#[derive(Clone, Debug, Default, Serialize, Copy)] #[serde(rename_all = "camelCase")] pub enum Easing { #[default]