Skip to content

Commit

Permalink
added new for ChartResize
Browse files Browse the repository at this point in the history
  • Loading branch information
LukaOber committed Oct 12, 2024
1 parent d197547 commit 72a07fe
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions charming/src/renderer/wasm_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Animation>,
pub animation: Option<Animation>,
}

impl ChartResize {
pub fn new(width: u32, height: u32, silent: bool, animation: Option<Animation>) -> Self {
Self {
width,
height,
silent,
animation,
}
}
}

#[derive(Serialize)]
#[derive(Clone, Debug, Serialize, Copy)]
pub struct Animation {
/// duration of the animation
pub duration: u32,
Expand All @@ -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]
Expand Down

0 comments on commit 72a07fe

Please sign in to comment.