Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

editor: Do not start scroll when hovering the scroll thumb during dragging events (#30782)

Finn Evers34be7830a3d8
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 4a70283cc3d..de024d86fc5 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -5538,7 +5538,9 @@ impl EditorElement {
editor.scroll_manager.show_scrollbars(window, cx);
cx.stop_propagation();
- } else if let Some((layout, axis)) = scrollbars_layout.get_hovered_axis(window)
+ } else if let Some((layout, axis)) = scrollbars_layout
+ .get_hovered_axis(window)
+ .filter(|_| !event.dragging())
{
if layout
.thumb_bounds
diff --git a/crates/editor/src/scroll.rs b/crates/editor/src/scroll.rs
index 368ad8cf879..e03ee55e616 100644
--- a/crates/editor/src/scroll.rs
+++ b/crates/editor/src/scroll.rs
@@ -374,6 +374,7 @@ impl ScrollManager {
pub fn dragging_scrollbar_axis(&self) -> Option<Axis> {
self.active_scrollbar
.as_ref()
+ .filter(|scrollbar| scrollbar.thumb_state == ScrollbarThumbState::Dragging)
.map(|scrollbar| scrollbar.axis)
}