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.

Fix pane magnification causing mouse to drag tabs unexpectedly (#26383)

Martim Aires de Sousa21cf2e38c548
diff --git a/crates/gpui/src/elements/div.rs b/crates/gpui/src/elements/div.rs
index b0ae2c24744..6b0761ef16d 100644
--- a/crates/gpui/src/elements/div.rs
+++ b/crates/gpui/src/elements/div.rs
@@ -1948,6 +1948,14 @@ impl Interactivity {
if pending_mouse_down.is_some() && hitbox.is_hovered(window) {
captured_mouse_down = pending_mouse_down.take();
window.refresh();
+ } else if pending_mouse_down.is_some() {
+ // Clear the pending mouse down event (without firing click handlers)
+ // if the hitbox is not being hovered.
+ // This avoids dragging elements that changed their position
+ // immediately after being clicked.
+ // See https://github.com/zed-industries/zed/issues/24600 for more details
+ pending_mouse_down.take();
+ window.refresh();
}
}
// Fire click handlers during the bubble phase.