Remove block_mouse_down in favor of stop_mouse_events_except_scroll (#30401)

This method was added in #20649 to be an alternative of `occlude` which
allows scroll events. It seems a bit arbitrary to only stop left mouse
downs, so this seems like it's probably an improvement.

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-05-29 16:07:34 -06:00 committed by GitHub
parent 9086784038
commit 8aef64bbfa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 5 additions and 10 deletions

View file

@ -1445,7 +1445,7 @@ impl InlineAssistant {
style: BlockStyle::Flex, style: BlockStyle::Flex,
render: Arc::new(move |cx| { render: Arc::new(move |cx| {
div() div()
.block_mouse_down() .block_mouse_except_scroll()
.bg(cx.theme().status().deleted_background) .bg(cx.theme().status().deleted_background)
.size_full() .size_full()
.h(height as f32 * cx.window.line_height()) .h(height as f32 * cx.window.line_height())

View file

@ -100,7 +100,7 @@ impl<T: 'static> Render for PromptEditor<T> {
v_flex() v_flex()
.key_context("PromptEditor") .key_context("PromptEditor")
.bg(cx.theme().colors().editor_background) .bg(cx.theme().colors().editor_background)
.block_mouse_down() .block_mouse_except_scroll()
.gap_0p5() .gap_0p5()
.border_y_1() .border_y_1()
.border_color(cx.theme().status().info_border) .border_color(cx.theme().status().info_border)

View file

@ -15021,7 +15021,7 @@ impl Editor {
text_style = text_style.highlight(highlight_style); text_style = text_style.highlight(highlight_style);
} }
div() div()
.block_mouse_down() .block_mouse_except_scroll()
.pl(cx.anchor_x) .pl(cx.anchor_x)
.child(EditorElement::new( .child(EditorElement::new(
&rename_editor, &rename_editor,

View file

@ -48,7 +48,7 @@ impl RenderOnce for ExtensionCard {
.absolute() .absolute()
.top_0() .top_0()
.left_0() .left_0()
.block_mouse_down() .block_mouse_except_scroll()
.cursor_default() .cursor_default()
.size_full() .size_full()
.items_center() .items_center()

View file

@ -958,11 +958,6 @@ pub trait InteractiveElement: Sized {
self self
} }
/// Stops propagation of left mouse down event.
fn block_mouse_down(mut self) -> Self {
self.on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation())
}
/// Block non-scroll mouse interactions with elements behind this element's hitbox. See /// Block non-scroll mouse interactions with elements behind this element's hitbox. See
/// [`Hitbox::is_hovered`] for details. /// [`Hitbox::is_hovered`] for details.
/// ///

View file

@ -162,7 +162,7 @@ impl EditorBlock {
div() div()
.id(cx.block_id) .id(cx.block_id)
.block_mouse_down() .block_mouse_except_scroll()
.flex() .flex()
.items_start() .items_start()
.min_h(text_line_height) .min_h(text_line_height)