layout fixes

This commit is contained in:
Martin Kavík 2024-06-17 11:35:13 +02:00
parent 5c778b4350
commit e59d10d23a
3 changed files with 8 additions and 10 deletions

View file

@ -6,7 +6,7 @@ use std::rc::Rc;
use wellen::GetItem; use wellen::GetItem;
use zoon::*; use zoon::*;
const SCOPE_VAR_ROW_MAX_WIDTH: u32 = 480; const MILLER_COLUMN_SCOPE_VAR_ROW_MIN_WIDTH: u32 = 480;
const MILLER_COLUMN_MAX_HEIGHT: u32 = 500; const MILLER_COLUMN_MAX_HEIGHT: u32 = 500;
#[derive(Clone)] #[derive(Clone)]
@ -116,7 +116,7 @@ impl ControlsPanel {
fn scopes_panel(&self, hierarchy: Rc<wellen::Hierarchy>) -> impl Element { fn scopes_panel(&self, hierarchy: Rc<wellen::Hierarchy>) -> impl Element {
Column::new() Column::new()
.s(Height::fill().min(150)) .s(Height::fill())
.s(Scrollbars::y_and_clip_x()) .s(Scrollbars::y_and_clip_x())
.s(Gap::new().y(20)) .s(Gap::new().y(20))
.s(Width::fill()) .s(Width::fill())
@ -165,7 +165,7 @@ impl ControlsPanel {
let s = self.clone(); let s = self.clone();
El::new() El::new()
.s(Height::fill()) .s(Height::fill())
.s(Scrollbars::both()) .s(Scrollbars::y_and_clip_x())
.s(Width::fill()) .s(Width::fill())
.child_signal(layout.signal().map(move |layout| match layout { .child_signal(layout.signal().map(move |layout| match layout {
Layout::Tree => { Layout::Tree => {
@ -279,7 +279,6 @@ impl ControlsPanel {
Layout::Tree => level * 30, Layout::Tree => level * 30,
Layout::Columns => 0, Layout::Columns => 0,
}))) })))
.s(Width::default().max(SCOPE_VAR_ROW_MAX_WIDTH))
.after_remove(move |_| { .after_remove(move |_| {
drop(task_collapse_on_parent_collapse); drop(task_collapse_on_parent_collapse);
drop(task_expand_or_collapse_on_selected_scope_in_level_change); drop(task_expand_or_collapse_on_selected_scope_in_level_change);
@ -370,7 +369,6 @@ impl ControlsPanel {
) -> impl Element { ) -> impl Element {
Button::new() Button::new()
.s(Padding::new().x(15).y(5)) .s(Padding::new().x(15).y(5))
.s(Font::new().wrap_anywhere())
.on_hovered_change(move |is_hovered| button_hovered.set_neq(is_hovered)) .on_hovered_change(move |is_hovered| button_hovered.set_neq(is_hovered))
.on_press( .on_press(
clone!((self.selected_scope_ref => selected_scope_ref, scope_for_ui) move || { clone!((self.selected_scope_ref => selected_scope_ref, scope_for_ui) move || {
@ -384,6 +382,7 @@ impl ControlsPanel {
fn vars_panel(&self, hierarchy: Rc<wellen::Hierarchy>) -> impl Element { fn vars_panel(&self, hierarchy: Rc<wellen::Hierarchy>) -> impl Element {
let selected_scope_ref = self.selected_scope_ref.clone(); let selected_scope_ref = self.selected_scope_ref.clone();
Column::new() Column::new()
.s(Align::new().top())
.s(Gap::new().y(20)) .s(Gap::new().y(20))
.s(Height::fill().min(150)) .s(Height::fill().min(150))
.s(Scrollbars::y_and_clip_x()) .s(Scrollbars::y_and_clip_x())
@ -446,7 +445,7 @@ impl ControlsPanel {
self.layout self.layout
.signal() .signal()
.map(|layout| matches!(layout, Layout::Columns)) .map(|layout| matches!(layout, Layout::Columns))
.map_true(|| Width::default().min(SCOPE_VAR_ROW_MAX_WIDTH)), .map_true(|| Width::default().min(MILLER_COLUMN_SCOPE_VAR_ROW_MIN_WIDTH)),
)) ))
.s(Align::new().left()) .s(Align::new().left())
.s(Gap::new().y(10)) .s(Gap::new().y(10))
@ -464,7 +463,6 @@ impl ControlsPanel {
Row::new() Row::new()
.s(Gap::new().x(10)) .s(Gap::new().x(10))
.s(Padding::new().right(15)) .s(Padding::new().right(15))
.s(Width::default().max(SCOPE_VAR_ROW_MAX_WIDTH))
.item(self.var_button(var_for_ui.clone())) .item(self.var_button(var_for_ui.clone()))
.item(self.var_tag_type(var_for_ui.clone())) .item(self.var_tag_type(var_for_ui.clone()))
.item(self.var_tag_index(var_for_ui.clone())) .item(self.var_tag_index(var_for_ui.clone()))
@ -477,7 +475,6 @@ impl ControlsPanel {
let selected_var_ref = self.selected_var_refs.clone(); let selected_var_ref = self.selected_var_refs.clone();
El::new().child( El::new().child(
Button::new() Button::new()
.s(Font::new().wrap_anywhere())
.s(Padding::new().x(15).y(5)) .s(Padding::new().x(15).y(5))
.s(Background::new().color_signal( .s(Background::new().color_signal(
hovered_signal.map_bool(|| color!("MediumSlateBlue"), || color!("SlateBlue")), hovered_signal.map_bool(|| color!("MediumSlateBlue"), || color!("SlateBlue")),

View file

@ -191,7 +191,7 @@ impl HeaderPanel {
Row::new() Row::new()
.s(Gap::new().x(15)) .s(Gap::new().x(15))
.s(Padding::new().x(5)) .s(Padding::new().x(5))
.item(El::new().child("Javascript command")) .item(El::new().child("Javascript commands"))
.item(El::new().s(Align::new().right()).child("Shift + Enter")) .item(El::new().s(Align::new().right()).child("Shift + Enter"))
) )
.item(self.command_editor(command_result)) .item(self.command_editor(command_result))

View file

@ -54,8 +54,9 @@ fn root() -> impl Element {
)) ))
.item( .item(
Row::new() Row::new()
.s(Height::fill()) .s(Scrollbars::y_and_clip_x())
.s(Gap::new().x(15)) .s(Gap::new().x(15))
.s(Height::growable().min(150))
.item(ControlsPanel::new( .item(ControlsPanel::new(
hierarchy.clone(), hierarchy.clone(),
selected_var_refs.clone(), selected_var_refs.clone(),