fmt
This commit is contained in:
parent
ef74c4d115
commit
c0872b0eba
|
@ -563,6 +563,7 @@ impl ControlsPanel {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Lazy loading to not freeze the main thread
|
// Lazy loading to not freeze the main thread
|
||||||
|
// @TODO replace with grouping and/or virtual scroll (https://dev.to/adamklein/build-your-own-virtual-scroll-part-i-11ib)
|
||||||
const CHUNK_SIZE: usize = 50;
|
const CHUNK_SIZE: usize = 50;
|
||||||
let mut chunked_vars_for_ui: Vec<Vec<VarForUI>> = <_>::default();
|
let mut chunked_vars_for_ui: Vec<Vec<VarForUI>> = <_>::default();
|
||||||
let mut chunk = Vec::with_capacity(CHUNK_SIZE);
|
let mut chunk = Vec::with_capacity(CHUNK_SIZE);
|
||||||
|
|
|
@ -33,7 +33,11 @@ pub async fn get_time_table() -> wellen::TimeTable {
|
||||||
platform::get_time_table().await
|
platform::get_time_table().await
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn load_signal_and_get_timeline(signal_ref: wellen::SignalRef, screen_width: u32, block_height: u32) -> shared::Timeline {
|
pub async fn load_signal_and_get_timeline(
|
||||||
|
signal_ref: wellen::SignalRef,
|
||||||
|
screen_width: u32,
|
||||||
|
block_height: u32,
|
||||||
|
) -> shared::Timeline {
|
||||||
platform::load_signal_and_get_timeline(signal_ref, screen_width, block_height).await
|
platform::load_signal_and_get_timeline(signal_ref, screen_width, block_height).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,11 @@ pub(super) async fn get_time_table() -> wellen::TimeTable {
|
||||||
serde_json::from_value(serde_json::to_value(time_table).unwrap_throw()).unwrap_throw()
|
serde_json::from_value(serde_json::to_value(time_table).unwrap_throw()).unwrap_throw()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) async fn load_signal_and_get_timeline(signal_ref: wellen::SignalRef, screen_width: u32, block_height: u32) -> shared::Timeline {
|
pub(super) async fn load_signal_and_get_timeline(
|
||||||
|
signal_ref: wellen::SignalRef,
|
||||||
|
screen_width: u32,
|
||||||
|
block_height: u32,
|
||||||
|
) -> shared::Timeline {
|
||||||
// @TODO implement, copy from tauri platform
|
// @TODO implement, copy from tauri platform
|
||||||
shared::Timeline { blocks: Vec::new() }
|
shared::Timeline { blocks: Vec::new() }
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,11 @@ pub(super) async fn get_time_table() -> wellen::TimeTable {
|
||||||
serde_wasm_bindgen::from_value(tauri_glue::get_time_table().await.unwrap_throw()).unwrap_throw()
|
serde_wasm_bindgen::from_value(tauri_glue::get_time_table().await.unwrap_throw()).unwrap_throw()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) async fn load_signal_and_get_timeline(signal_ref: wellen::SignalRef, screen_width: u32, block_height: u32) -> shared::Timeline {
|
pub(super) async fn load_signal_and_get_timeline(
|
||||||
|
signal_ref: wellen::SignalRef,
|
||||||
|
screen_width: u32,
|
||||||
|
block_height: u32,
|
||||||
|
) -> shared::Timeline {
|
||||||
serde_wasm_bindgen::from_value(
|
serde_wasm_bindgen::from_value(
|
||||||
tauri_glue::load_signal_and_get_timeline(signal_ref.index(), screen_width, block_height)
|
tauri_glue::load_signal_and_get_timeline(signal_ref.index(), screen_width, block_height)
|
||||||
.await
|
.await
|
||||||
|
@ -55,7 +59,11 @@ mod tauri_glue {
|
||||||
pub async fn get_time_table() -> Result<JsValue, JsValue>;
|
pub async fn get_time_table() -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
#[wasm_bindgen(catch)]
|
#[wasm_bindgen(catch)]
|
||||||
pub async fn load_signal_and_get_timeline(signal_ref_index: usize, screen_width: u32, block_height: u32) -> Result<JsValue, JsValue>;
|
pub async fn load_signal_and_get_timeline(
|
||||||
|
signal_ref_index: usize,
|
||||||
|
screen_width: u32,
|
||||||
|
block_height: u32,
|
||||||
|
) -> Result<JsValue, JsValue>;
|
||||||
|
|
||||||
#[wasm_bindgen(catch)]
|
#[wasm_bindgen(catch)]
|
||||||
pub async fn unload_signal(signal_ref_index: usize) -> Result<(), JsValue>;
|
pub async fn unload_signal(signal_ref_index: usize) -> Result<(), JsValue>;
|
||||||
|
|
|
@ -116,7 +116,12 @@ impl WaveformPanel {
|
||||||
|
|
||||||
let var = hierarchy.get(var_ref);
|
let var = hierarchy.get(var_ref);
|
||||||
let signal_ref = var.signal_ref();
|
let signal_ref = var.signal_ref();
|
||||||
let timeline = platform::load_signal_and_get_timeline(signal_ref, controller.screen_width(), ROW_HEIGHT).await;
|
let timeline = platform::load_signal_and_get_timeline(
|
||||||
|
signal_ref,
|
||||||
|
controller.screen_width(),
|
||||||
|
ROW_HEIGHT,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
let timescale = hierarchy.timescale();
|
let timescale = hierarchy.timescale();
|
||||||
// @TODO remove
|
// @TODO remove
|
||||||
|
|
|
@ -5,7 +5,7 @@ pub mod wellen_helpers;
|
||||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||||
#[serde(crate = "serde")]
|
#[serde(crate = "serde")]
|
||||||
pub struct Timeline {
|
pub struct Timeline {
|
||||||
pub blocks: Vec<TimelineBlock>
|
pub blocks: Vec<TimelineBlock>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||||
|
|
|
@ -97,7 +97,7 @@ pub fn run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signal_to_timeline(
|
fn signal_to_timeline(
|
||||||
signal: &wellen::Signal,
|
signal: &wellen::Signal,
|
||||||
time_table: &[wellen::Time],
|
time_table: &[wellen::Time],
|
||||||
screen_width: u32,
|
screen_width: u32,
|
||||||
block_height: u32,
|
block_height: u32,
|
||||||
|
@ -108,7 +108,7 @@ fn signal_to_timeline(
|
||||||
const LABEL_X_PADDING: u32 = 10;
|
const LABEL_X_PADDING: u32 = 10;
|
||||||
|
|
||||||
let Some(last_time) = time_table.last().copied() else {
|
let Some(last_time) = time_table.last().copied() else {
|
||||||
return shared::Timeline::default()
|
return shared::Timeline::default();
|
||||||
};
|
};
|
||||||
|
|
||||||
let last_time = last_time as f64;
|
let last_time = last_time as f64;
|
||||||
|
@ -136,7 +136,7 @@ fn signal_to_timeline(
|
||||||
let block_width = (next_block_x - block_x) as u32;
|
let block_width = (next_block_x - block_x) as u32;
|
||||||
if block_width < MIN_BLOCK_WIDTH {
|
if block_width < MIN_BLOCK_WIDTH {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let value = value.to_string();
|
let value = value.to_string();
|
||||||
// @TODO dynamic formatter
|
// @TODO dynamic formatter
|
||||||
|
@ -158,7 +158,7 @@ fn signal_to_timeline(
|
||||||
x: block_x as u32,
|
x: block_x as u32,
|
||||||
width: block_width,
|
width: block_width,
|
||||||
height: block_height,
|
height: block_height,
|
||||||
label,
|
label,
|
||||||
};
|
};
|
||||||
blocks.push(block);
|
blocks.push(block);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue