From 9c9928d226687466497422d5b970e69e48f8672e Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Fri, 6 May 2022 20:48:57 -0400 Subject: [PATCH] fix: tui values --- packages/tui/src/hooks.rs | 2 +- packages/tui/src/layout.rs | 8 +++++--- packages/tui/src/style_attributes.rs | 6 ++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/tui/src/hooks.rs b/packages/tui/src/hooks.rs index fd3f7fe01..c9d1e2a8c 100644 --- a/packages/tui/src/hooks.rs +++ b/packages/tui/src/hooks.rs @@ -320,7 +320,7 @@ impl InnerInputState { let node_layout = layout.layout(node.state.layout.node.unwrap()).unwrap(); let currently_contains = layout_contains_point(node_layout, new_pos); - if currently_contains && clicked { + if currently_contains { try_create_event( "mousedown", Arc::new(prepare_mouse_data(mouse_data, node_layout)), diff --git a/packages/tui/src/layout.rs b/packages/tui/src/layout.rs index f56f48955..c13435896 100644 --- a/packages/tui/src/layout.rs +++ b/packages/tui/src/layout.rs @@ -79,9 +79,11 @@ impl ChildDepState for StretchLayout { } } else { // gather up all the styles from the attribute list - for &Attribute { name, value, .. } in node.attributes() { - assert!(SORTED_LAYOUT_ATTRS.binary_search(&name).is_ok()); - apply_layout_attributes(name, value, &mut style); + for Attribute { name, value, .. } in node.attributes() { + assert!(SORTED_LAYOUT_ATTRS.binary_search(name).is_ok()); + if let Some(text) = value.as_text() { + apply_layout_attributes(name, text, &mut style); + } } // the root node fills the entire area diff --git a/packages/tui/src/style_attributes.rs b/packages/tui/src/style_attributes.rs index cb140cfcf..fd8d51cb3 100644 --- a/packages/tui/src/style_attributes.rs +++ b/packages/tui/src/style_attributes.rs @@ -78,8 +78,10 @@ impl ParentDepState for StyleModifier { } // gather up all the styles from the attribute list - for &Attribute { name, value, .. } in node.attributes() { - apply_style_attributes(name, value, &mut new); + for Attribute { name, value, .. } in node.attributes() { + if let Some(text) = value.as_text() { + apply_style_attributes(name, text, &mut new); + } } // keep the text styling from the parent element