diagram_panel.rs

This commit is contained in:
Martin Kavík 2024-10-07 20:44:37 +02:00
parent d291e84f61
commit c1b0eb33bf
2 changed files with 84 additions and 38 deletions

View file

@ -0,0 +1,24 @@
use zoon::*;
#[derive(Clone)]
pub struct DiagramPanel {
}
impl DiagramPanel {
pub fn new(
) -> impl Element {
Self {
}
.root()
}
fn root(&self) -> impl Element {
Column::new()
.s(Padding::all(20))
.s(Scrollbars::y_and_clip_x())
.s(Width::fill())
.s(Height::fill())
.s(Gap::new().y(20))
.item("Diagram panel")
}
}

View file

@ -7,6 +7,9 @@ mod script_bridge;
mod controls_panel;
use controls_panel::ControlsPanel;
mod diagram_panel;
use diagram_panel::DiagramPanel;
mod waveform_panel;
use waveform_panel::{PixiController, WaveformPanel};
@ -28,8 +31,10 @@ enum Layout {
#[derive(Clone, Copy, Default)]
enum Mode {
#[default]
// @TODO make default
// #[default]
Waves,
#[default]
Diagrams,
}
@ -71,6 +76,11 @@ fn root() -> impl Element {
mode.clone(),
loaded_filename.clone(),
))
.item_signal(mode.signal().map(clone!((hierarchy, selected_var_refs, loaded_filename, canvas_controller) move |mode| match mode {
Mode::Waves => {
Column::new()
.s(Height::fill())
.s(Scrollbars::y_and_clip_x())
.item(
Row::new()
.s(Scrollbars::y_and_clip_x())
@ -100,7 +110,11 @@ fn root() -> impl Element {
}
}),
)
.item_signal(
.item_signal({
let hierarchy = hierarchy.clone();
let selected_var_refs = selected_var_refs.clone();
let loaded_filename = loaded_filename.clone();
let canvas_controller = canvas_controller.clone();
map_ref!{
let layout = layout.signal(),
let hierarchy_is_some = hierarchy.signal_ref(Option::is_some) => {
@ -112,6 +126,14 @@ fn root() -> impl Element {
)))
}
}
)
})
}
Mode::Diagrams => {
Column::new()
.s(Height::fill())
.s(Scrollbars::y_and_clip_x())
.item(DiagramPanel::new())
}
})))
.item(CommandPanel::new())
}