diff --git a/frontend/src/waveform_panel/pixi_canvas.rs b/frontend/src/waveform_panel/pixi_canvas.rs index 2ac3dcf..b0a5687 100644 --- a/frontend/src/waveform_panel/pixi_canvas.rs +++ b/frontend/src/waveform_panel/pixi_canvas.rs @@ -40,11 +40,12 @@ impl PixiCanvas { let width = width.signal(), let height = height.signal() => (*width, *height) } - .for_each_sync(clone!((controller) move |(width, height)| { + .throttle(|| Timer::sleep(50)) + .for_each(clone!((controller) move |(width, height)| clone!((controller) async move { if let Some(controller) = controller.lock_ref().as_ref() { - controller.resize(width, height); + controller.resize(width, height).await } - })), + }))), ); let task_with_controller = Mutable::new(None); // -- FastWave-specific -- @@ -120,7 +121,7 @@ mod js_bridge { pub async fn init(this: &PixiController, parent_element: &JsValue); #[wasm_bindgen(method)] - pub fn resize(this: &PixiController, width: u32, height: u32); + pub async fn resize(this: &PixiController, width: u32, height: u32); #[wasm_bindgen(method)] pub fn destroy(this: &PixiController); diff --git a/frontend/typescript/bundles/pixi_canvas.js b/frontend/typescript/bundles/pixi_canvas.js index 3c110fa..435ea5f 100644 --- a/frontend/typescript/bundles/pixi_canvas.js +++ b/frontend/typescript/bundles/pixi_canvas.js @@ -35151,12 +35151,12 @@ var PixiController = class { } // Default automatic Pixi resizing according to the parent is not reliable // and the `app.renderer`'s `resize` event is fired on every browser window size change - resize(width, height) { + async resize(width, height) { this.app.resize(); const width_changed = width !== this.previous_parent_width; this.previous_parent_width = width; if (width_changed) { - this.redraw_rows(); + await this.redraw_rows(); } } destroy() { @@ -35175,11 +35175,11 @@ var PixiController = class { return this.app.screen.width; } // -- FastWave-specific -- - redraw_rows() { - this.var_signal_rows.forEach(async (row) => { + async redraw_rows() { + await Promise.all(this.var_signal_rows.map(async (row) => { const timeline = await this.timeline_getter(row.signal_ref_index, this.app.screen.width, this.row_height); row.redraw(timeline); - }); + })); } remove_var(index) { if (typeof this.var_signal_rows[index] !== "undefined") { diff --git a/frontend/typescript/pixi_canvas/pixi_canvas.ts b/frontend/typescript/pixi_canvas/pixi_canvas.ts index 7800ab5..0bbf883 100644 --- a/frontend/typescript/pixi_canvas/pixi_canvas.ts +++ b/frontend/typescript/pixi_canvas/pixi_canvas.ts @@ -45,13 +45,13 @@ export class PixiController { // Default automatic Pixi resizing according to the parent is not reliable // and the `app.renderer`'s `resize` event is fired on every browser window size change - resize(width: number, height: number) { + async resize(width: number, height: number) { this.app.resize(); // -- FastWave-specific -- const width_changed = width !== this.previous_parent_width; this.previous_parent_width = width; if (width_changed) { - this.redraw_rows(); + await this.redraw_rows(); } } @@ -74,11 +74,11 @@ export class PixiController { // -- FastWave-specific -- - redraw_rows() { - this.var_signal_rows.forEach(async row => { + async redraw_rows() { + await Promise.all(this.var_signal_rows.map(async row => { const timeline = await this.timeline_getter(row.signal_ref_index, this.app.screen.width, this.row_height); row.redraw(timeline); - }); + })) } remove_var(index: number) { diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 70b9de9..2e9c17d 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -140,7 +140,7 @@ fn signal_to_timeline( let value = value.to_string(); // @TODO dynamic formatter - let value = u32::from_str_radix(&value, 2).unwrap(); + let value = u128::from_str_radix(&value, 2).unwrap(); let value = format!("{value:x}"); let value_width = value.chars().count() as u32 * LETTER_WIDTH;