Restore click events on Buttons using on_mouse_down

This commit is contained in:
Marshall Bowers 2023-10-12 16:56:48 -04:00
parent 6e5ad75c5c
commit 36bca4f0d6

View file

@ -1,7 +1,7 @@
use std::marker::PhantomData; use std::marker::PhantomData;
use std::sync::Arc; use std::sync::Arc;
use gpui3::{DefiniteLength, Hsla, WindowContext}; use gpui3::{DefiniteLength, Hsla, Interactive, MouseButton, WindowContext};
use crate::prelude::*; use crate::prelude::*;
use crate::{h_stack, theme, Icon, IconColor, IconElement, Label, LabelColor, LabelSize}; use crate::{h_stack, theme, Icon, IconColor, IconElement, Label, LabelColor, LabelSize};
@ -195,20 +195,11 @@ impl<S: 'static + Send + Sync + Clone> Button<S> {
el = el.w(width).justify_center(); el = el.w(width).justify_center();
} }
// el.when_some(self.handlers.click.clone(), |el, click_handler| { if let Some(click_handler) = self.handlers.click.clone() {
// el.id(0) el = el.on_mouse_down(MouseButton::Left, move |state, event, cx| {
// .on_click(MouseButton::Left, move |state, event, cx| { click_handler(state, cx);
// click_handler(state, cx); });
// }) }
// });
// if let Some(click_handler) = self.handlers.click.clone() {
// el = el
// .id(0)
// .on_click(MouseButton::Left, move |state, event, cx| {
// click_handler(state, cx);
// });
// }
el el
} }