Skip to content

Commit

Permalink
Allowing not specify size to WasmRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
MikhailNazarov authored and yuankunzhang committed Oct 13, 2024
1 parent 6c33db0 commit d4ef7bc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions charming/src/renderer/wasm_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@ use wasm_bindgen::JsValue;

pub struct WasmRenderer {
theme: Theme,
width: u32,
height: u32,
width: Option<u32>,
height: Option<u32>,
}

impl WasmRenderer {
pub fn new(width: u32, height: u32) -> Self {
Self {
theme: Theme::Default,
width: Some(width),
height: Some(height),
}
}

pub fn new_opt(width: Option<u32>, height: Option<u32>) -> Self {
Self {
theme: Theme::Default,
width,
Expand Down Expand Up @@ -64,8 +72,8 @@ impl WasmRenderer {

#[derive(Clone, Debug, Serialize, Copy)]
struct ChartSize {
width: u32,
height: u32,
width: Option<u32>,
height: Option<u32>,
}

#[derive(Clone, Debug, Serialize, Copy)]
Expand Down

0 comments on commit d4ef7bc

Please sign in to comment.