workspace: Close toasts on middle mouse click (#48208)
Release Notes: - Allow closing notification toasts via middle mouse clicks
This commit is contained in:
1 parent
e4f962dee3
commit
e5d5a7c44e
1 file changed
+10
-1
@@ -3,7 +3,10 @@ use std::{
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use gpui::{AnyView, DismissEvent, Entity, EntityId, FocusHandle, ManagedView, Subscription, Task};
|
||||
use gpui::{
|
||||
AnyView, DismissEvent, Entity, EntityId, FocusHandle, ManagedView, MouseButton, Subscription,
|
||||
Task,
|
||||
};
|
||||
use ui::{animation::DefaultAnimations, prelude::*};
|
||||
use zed_actions::toast;
|
||||
|
||||
@@ -244,6 +247,12 @@ impl Render for ToastLayer {
|
||||
.on_click(|_, _, cx| {
|
||||
cx.stop_propagation();
|
||||
})
|
||||
.on_mouse_down(
|
||||
MouseButton::Middle,
|
||||
cx.listener(|this, _, _, cx| {
|
||||
this.hide_toast(cx);
|
||||
}),
|
||||
)
|
||||
.child(active_toast.toast.view()),
|
||||
)
|
||||
.animate_in(AnimationDirection::FromBottom, true),
|
||||
|
||||
Reference in new issue
Block a user