Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new for ChartResize #104

Merged
merged 1 commit into from
Oct 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading