diff --git a/crates/ui/src/list/list_item.rs b/crates/ui/src/list/list_item.rs index 2a903668..33a07bff 100644 --- a/crates/ui/src/list/list_item.rs +++ b/crates/ui/src/list/list_item.rs @@ -1,7 +1,7 @@ use gpui::{ div, prelude::FluentBuilder as _, AnyElement, ClickEvent, Div, ElementId, InteractiveElement, - IntoElement, MouseButton, MouseDownEvent, MouseMoveEvent, ParentElement, RenderOnce, - SharedString, Stateful, StatefulInteractiveElement as _, Styled, WindowContext, + IntoElement, MouseMoveEvent, ParentElement, RenderOnce, SharedString, Stateful, + StatefulInteractiveElement as _, Styled, WindowContext, }; use smallvec::SmallVec; @@ -17,7 +17,6 @@ pub struct ListItem { group_id: Option, on_click: Option>, on_mouse_enter: Option>, - on_secondary_mouse_down: Option>, suffix: Option AnyElement + 'static>>, children: SmallVec<[AnyElement; 2]>, } @@ -30,7 +29,6 @@ impl ListItem { selected: false, confirmed: false, on_click: None, - on_secondary_mouse_down: None, on_mouse_enter: None, check_icon: None, suffix: None, @@ -83,14 +81,6 @@ impl ListItem { self } - pub fn on_secondary_mouse_down( - mut self, - handler: impl Fn(&MouseDownEvent, &mut WindowContext) + 'static, - ) -> Self { - self.on_secondary_mouse_down = Some(Box::new(handler)); - self - } - pub fn on_mouse_enter( mut self, handler: impl Fn(&MouseMoveEvent, &mut WindowContext) + 'static, @@ -147,14 +137,6 @@ impl RenderOnce for ListItem { .when(!is_active && !self.disabled, |this| { this.hover(|this| this.bg(cx.theme().list_hover)) }) - // Right click - .when_some(self.on_secondary_mouse_down, |this, on_mouse_down| { - if !self.disabled { - this.on_mouse_down(MouseButton::Right, move |ev, cx| (on_mouse_down)(ev, cx)) - } else { - this - } - }) // Mouse enter .when_some(self.on_mouse_enter, |this, on_mouse_enter| { if !self.disabled { diff --git a/crates/ui/src/switch.rs b/crates/ui/src/switch.rs index d2190600..9cd795f3 100644 --- a/crates/ui/src/switch.rs +++ b/crates/ui/src/switch.rs @@ -26,7 +26,7 @@ impl LabelSide { #[derive(IntoElement)] pub struct Switch { - id: SharedString, + id: ElementId, base: Stateful
, checked: bool, disabled: bool, @@ -37,9 +37,8 @@ pub struct Switch { } impl Switch { - pub fn new(id: impl Into) -> Self { - let id: SharedString = id.into(); - + pub fn new(id: impl Into) -> Self { + let id: ElementId = id.into(); Self { id: id.clone(), base: div().id(id), @@ -90,7 +89,6 @@ impl Disableable for Switch { impl RenderOnce for Switch { fn render(self, cx: &mut gpui::WindowContext) -> impl IntoElement { let theme = cx.theme(); - let group_id = format!("switch_group_{:?}", self.id); let checked = self.checked; let (bg, toggle_bg) = match self.checked { @@ -115,7 +113,6 @@ impl RenderOnce for Switch { h_flex() .id(self.id) - .group(group_id) .items_center() .gap_2() .when(self.label_side.left(), |this| this.flex_row_reverse())