From 603765732e6dd9e4ec94cbe6a6291d1d08c15f53 Mon Sep 17 00:00:00 2001 From: Nate Butler Date: Fri, 13 Oct 2023 14:50:37 -0400 Subject: [PATCH] Checkpoint --- crates/gpui3/src/elements/hoverable.rs | 3 ++- crates/ui2/src/components/list.rs | 3 +++ crates/ui2/src/components/notification.rs | 1 + crates/ui2/src/prelude.rs | 5 +++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/gpui3/src/elements/hoverable.rs b/crates/gpui3/src/elements/hoverable.rs index e34a7ad7b5fbdb4b4cbe549334590bdc912435dd..44d8c123cf17ca3ad6a1aea06a4f1358a4f7cf1c 100644 --- a/crates/gpui3/src/elements/hoverable.rs +++ b/crates/gpui3/src/elements/hoverable.rs @@ -108,9 +108,10 @@ where let hovered = self.hovered.clone(); move |_, event: &MouseMoveEvent, phase, cx| { - if phase == DispatchPhase::Capture { + if phase == DispatchPhase::Bubble { if target_bounds.contains_point(event.position) != hovered.load(SeqCst) { cx.notify(); + cx.stop_propagation(); } } } diff --git a/crates/ui2/src/components/list.rs b/crates/ui2/src/components/list.rs index 9bdffa991c4a5378fbe1134b90e265f2d50e2615..922bbfc2ba6608ea2264b52af9f98d9be25d4568 100644 --- a/crates/ui2/src/components/list.rs +++ b/crates/ui2/src/components/list.rs @@ -397,6 +397,7 @@ impl ListEntry { div() .relative() + .group("") .fill(color.surface) .when(self.state == InteractionState::Focused, |this| { this.border().border_color(color.border_focused) @@ -411,6 +412,8 @@ impl ListEntry { .h_full() .flex() .justify_center() + .group_hover("") + .fill(color.border_focused) .child( h_stack() .child(div().w_px().h_full()) diff --git a/crates/ui2/src/components/notification.rs b/crates/ui2/src/components/notification.rs index d8f6919463108d9e5e26a910405ddc9586c7b9d8..b364bfa4ae442acdfd21149bd7b595b1673ba57e 100644 --- a/crates/ui2/src/components/notification.rs +++ b/crates/ui2/src/components/notification.rs @@ -24,6 +24,7 @@ pub struct NotificationToast { impl NotificationToast { pub fn new( + // TODO: use a `SharedString` here title: impl Into, message: impl Into, primary_action: Button, diff --git a/crates/ui2/src/prelude.rs b/crates/ui2/src/prelude.rs index 9b369c0701b3280b127b36c2fa0ebdf6891f8597..5b6f166c4879a5562d8d60b2e18a06fdaf063d1d 100644 --- a/crates/ui2/src/prelude.rs +++ b/crates/ui2/src/prelude.rs @@ -19,7 +19,7 @@ pub struct Token { impl Default for Token { fn default() -> Self { Self { - list_indent_depth: AbsoluteLength::Rems(rems(0.3)), + list_indent_depth: rems(0.3).into(), default_panel_size: AbsoluteLength::Rems(rems(16.)), state_hover_background: hsla(0.0, 0.0, 0.0, 0.08), state_active_background: hsla(0.0, 0.0, 0.0, 0.16), @@ -74,7 +74,8 @@ pub struct ThemeColor { /// or tapped on a touch screen. /// - TODO: Map to step 5. pub filled_element_active: Hsla, - /// The background color of a selected element, like a selected tab, a button toggled on, or a checkbox that is checked. + /// The background color of a selected element, like a selected tab, + /// a button toggled on, or a checkbox that is checked. pub filled_element_selected: Hsla, pub filled_element_disabled: Hsla, pub ghost_element: Hsla,