From 8aef64bbfadc0060865c4d4b764f4769f6b4720e Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Thu, 29 May 2025 16:07:34 -0600 Subject: [PATCH] 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 --- crates/agent/src/inline_assistant.rs | 2 +- crates/agent/src/inline_prompt_editor.rs | 2 +- crates/editor/src/editor.rs | 2 +- crates/extensions_ui/src/components/extension_card.rs | 2 +- crates/gpui/src/elements/div.rs | 5 ----- crates/repl/src/session.rs | 2 +- 6 files changed, 5 insertions(+), 10 deletions(-) diff --git a/crates/agent/src/inline_assistant.rs b/crates/agent/src/inline_assistant.rs index 4ce5829a76a643894af26466aca0545a443b27dd..ca286ffb6b6d90149d492e047730deb304b90979 100644 --- a/crates/agent/src/inline_assistant.rs +++ b/crates/agent/src/inline_assistant.rs @@ -1445,7 +1445,7 @@ impl InlineAssistant { style: BlockStyle::Flex, render: Arc::new(move |cx| { div() - .block_mouse_down() + .block_mouse_except_scroll() .bg(cx.theme().status().deleted_background) .size_full() .h(height as f32 * cx.window.line_height()) diff --git a/crates/agent/src/inline_prompt_editor.rs b/crates/agent/src/inline_prompt_editor.rs index 08c8060bfae15e2dc184e205b04350b04f1d6bcd..283b5d1ce19836630e607e96f11aa3d38f9bf332 100644 --- a/crates/agent/src/inline_prompt_editor.rs +++ b/crates/agent/src/inline_prompt_editor.rs @@ -100,7 +100,7 @@ impl Render for PromptEditor { v_flex() .key_context("PromptEditor") .bg(cx.theme().colors().editor_background) - .block_mouse_down() + .block_mouse_except_scroll() .gap_0p5() .border_y_1() .border_color(cx.theme().status().info_border) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 2f60208b61eedf6a8e773af645c99f80bde755cb..ccf18ee195151aa1e91970f4d33fb6999599d0ea 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -15021,7 +15021,7 @@ impl Editor { text_style = text_style.highlight(highlight_style); } div() - .block_mouse_down() + .block_mouse_except_scroll() .pl(cx.anchor_x) .child(EditorElement::new( &rename_editor, diff --git a/crates/extensions_ui/src/components/extension_card.rs b/crates/extensions_ui/src/components/extension_card.rs index 326b0fc2668035be1bd30fa7b83066c94c468d30..abdd32fee99cd056e9fece60a2ff7646f55cd264 100644 --- a/crates/extensions_ui/src/components/extension_card.rs +++ b/crates/extensions_ui/src/components/extension_card.rs @@ -48,7 +48,7 @@ impl RenderOnce for ExtensionCard { .absolute() .top_0() .left_0() - .block_mouse_down() + .block_mouse_except_scroll() .cursor_default() .size_full() .items_center() diff --git a/crates/gpui/src/elements/div.rs b/crates/gpui/src/elements/div.rs index c6a0520b26487676fcb0c1d7253c5894085d7592..fd78591dd16d8540fd1f330f1f380319e43c119f 100644 --- a/crates/gpui/src/elements/div.rs +++ b/crates/gpui/src/elements/div.rs @@ -958,11 +958,6 @@ pub trait InteractiveElement: Sized { 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 /// [`Hitbox::is_hovered`] for details. /// diff --git a/crates/repl/src/session.rs b/crates/repl/src/session.rs index 20a891978b04cf73bca8ddd79772cdbb0afaa8de..20518fb12cc39c54993a077decd0ee1ff5f81c8b 100644 --- a/crates/repl/src/session.rs +++ b/crates/repl/src/session.rs @@ -162,7 +162,7 @@ impl EditorBlock { div() .id(cx.block_id) - .block_mouse_down() + .block_mouse_except_scroll() .flex() .items_start() .min_h(text_line_height)