signal_to_timeline
This commit is contained in:
parent
6e85b7fa35
commit
d8c1b0abac
10 changed files with 92 additions and 21 deletions
|
@ -37,8 +37,8 @@ pub async fn load_and_get_signal(signal_ref: wellen::SignalRef) -> wellen::Signa
|
|||
platform::load_and_get_signal(signal_ref).await
|
||||
}
|
||||
|
||||
pub async fn timeline(signal_ref: wellen::SignalRef, screen_width: u32) -> shared::Timeline {
|
||||
platform::timeline(signal_ref, screen_width).await
|
||||
pub async fn timeline(signal_ref: wellen::SignalRef, screen_width: u32, block_height: u32) -> shared::Timeline {
|
||||
platform::timeline(signal_ref, screen_width, block_height).await
|
||||
}
|
||||
|
||||
pub async fn unload_signal(signal_ref: wellen::SignalRef) {
|
||||
|
|
|
@ -91,7 +91,7 @@ pub(super) async fn load_and_get_signal(signal_ref: wellen::SignalRef) -> wellen
|
|||
serde_json::from_value(serde_json::to_value(signal).unwrap_throw()).unwrap_throw()
|
||||
}
|
||||
|
||||
pub(super) async fn timeline(signal_ref: wellen::SignalRef, screen_width: u32) -> shared::Timeline {
|
||||
pub(super) async fn timeline(signal_ref: wellen::SignalRef, screen_width: u32, block_height: u32) -> shared::Timeline {
|
||||
shared::Timeline { blocks: Vec::new() }
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ pub(super) async fn load_and_get_signal(signal_ref: wellen::SignalRef) -> wellen
|
|||
.unwrap_throw()
|
||||
}
|
||||
|
||||
pub(super) async fn timeline(signal_ref: wellen::SignalRef, screen_width: u32) -> shared::Timeline {
|
||||
pub(super) async fn timeline(signal_ref: wellen::SignalRef, screen_width: u32, block_height: u32) -> shared::Timeline {
|
||||
serde_wasm_bindgen::from_value(
|
||||
tauri_glue::timeline(signal_ref.index(), screen_width)
|
||||
tauri_glue::timeline(signal_ref.index(), screen_width, block_height)
|
||||
.await
|
||||
.unwrap_throw(),
|
||||
)
|
||||
|
@ -67,7 +67,7 @@ mod tauri_glue {
|
|||
pub async fn load_and_get_signal(signal_ref_index: usize) -> Result<JsValue, JsValue>;
|
||||
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn timeline(signal_ref_index: usize, screen_width: u32) -> Result<JsValue, JsValue>;
|
||||
pub async fn timeline(signal_ref_index: usize, screen_width: u32, block_height: u32) -> Result<JsValue, JsValue>;
|
||||
|
||||
#[wasm_bindgen(catch)]
|
||||
pub async fn unload_signal(signal_ref_index: usize) -> Result<(), JsValue>;
|
||||
|
|
|
@ -117,7 +117,7 @@ impl WaveformPanel {
|
|||
|
||||
let var = hierarchy.get(var_ref);
|
||||
let signal_ref = var.signal_ref();
|
||||
let timeline = platform::timeline(signal_ref, controller.screen_width()).await;
|
||||
let timeline = platform::timeline(signal_ref, controller.screen_width(), ROW_HEIGHT).await;
|
||||
|
||||
// @TODO remove
|
||||
zoon::println!("Timeline in Rust: {timeline:#?}");
|
||||
|
|
|
@ -35225,7 +35225,7 @@ var VarSignalRow = class {
|
|||
const signal_block = new Container();
|
||||
signal_block.x = timeline_block.x;
|
||||
this.signal_blocks_container.addChild(signal_block);
|
||||
const background = new Graphics().roundRect(0, 0, timeline_block.width, this.row_height, 15).fill("SlateBlue");
|
||||
const background = new Graphics().roundRect(0, 0, timeline_block.width, timeline_block.height, 15).fill("SlateBlue");
|
||||
signal_block.addChild(background);
|
||||
if (timeline_block.label !== void 0) {
|
||||
const label = new Text({ text: timeline_block.label.text, style: this.label_style });
|
||||
|
|
|
@ -2526,8 +2526,8 @@ async function get_time_table() {
|
|||
async function load_and_get_signal(signal_ref_index) {
|
||||
return await invoke2("load_and_get_signal", { signal_ref_index });
|
||||
}
|
||||
async function timeline(signal_ref_index, screen_width) {
|
||||
return await invoke2("timeline", { signal_ref_index, screen_width });
|
||||
async function timeline(signal_ref_index, screen_width, block_height) {
|
||||
return await invoke2("timeline", { signal_ref_index, screen_width, block_height });
|
||||
}
|
||||
async function unload_signal(signal_ref_index) {
|
||||
return await invoke2("unload_signal", { signal_ref_index });
|
||||
|
|
|
@ -7,6 +7,7 @@ type Timeline = {
|
|||
type TimelineBlock = {
|
||||
x: number,
|
||||
width: number,
|
||||
height: number,
|
||||
label: TimeLineBlockLabel | undefined,
|
||||
}
|
||||
type TimeLineBlockLabel = {
|
||||
|
@ -153,7 +154,7 @@ class VarSignalRow {
|
|||
|
||||
// background
|
||||
const background = new Graphics()
|
||||
.roundRect(0, 0, timeline_block.width, this.row_height, 15)
|
||||
.roundRect(0, 0, timeline_block.width, timeline_block.height, 15)
|
||||
.fill("SlateBlue");
|
||||
signal_block.addChild(background);
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ export async function load_and_get_signal(signal_ref_index: number): Promise<Wel
|
|||
return await invoke("load_and_get_signal", { signal_ref_index });
|
||||
}
|
||||
|
||||
export async function timeline(signal_ref_index: number, screen_width: number): Promise<Timeline> {
|
||||
return await invoke("timeline", { signal_ref_index, screen_width });
|
||||
export async function timeline(signal_ref_index: number, screen_width: number, block_height: number): Promise<Timeline> {
|
||||
return await invoke("timeline", { signal_ref_index, screen_width, block_height });
|
||||
}
|
||||
|
||||
export async function unload_signal(signal_ref_index: number): Promise<void> {
|
||||
|
|
Reference in a new issue