Avoid creating occlusions for editor blocks, since these block mouse wheel events (#20649)

Just block mouse down events, and in the case of the inline assist
prompt, set the default cursor.

Release Notes:

- N/A

Co-authored-by: Richard <richard@zed.dev>
This commit is contained in:
Max Brunsfeld
2024-11-13 21:02:54 -08:00
committed by GitHub
co-authored by Richard
parent 6b3c909155
commit 093c9cc87b
6 changed files with 20 additions and 13 deletions
+8 -2
View File
@@ -511,7 +511,7 @@ impl Interactivity {
}
/// Block the mouse from interacting with this element or any of its children
/// The imperative API equivalent to [`InteractiveElement::block_mouse`]
/// The imperative API equivalent to [`InteractiveElement::occlude`]
pub fn occlude_mouse(&mut self) {
self.occlude_mouse = true;
}
@@ -874,11 +874,17 @@ pub trait InteractiveElement: Sized {
}
/// Block the mouse from interacting with this element or any of its children
/// The fluent API equivalent to [`Interactivity::block_mouse`]
/// The fluent API equivalent to [`Interactivity::occlude_mouse`]
fn occlude(mut self) -> Self {
self.interactivity().occlude_mouse();
self
}
/// Block the mouse from interacting with this element or any of its children
/// The fluent API equivalent to [`Interactivity::occlude_mouse`]
fn block_mouse_down(mut self) -> Self {
self.on_mouse_down(MouseButton::Left, |_, cx| cx.stop_propagation())
}
}
/// A trait for elements that want to use the standard GPUI interactivity features