mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-30 14:17:02 +00:00
Use a MouseEventHandler
for activating tabs on mouse down
Previously, we were using an `EventHandler` which doesn't take into account other mouse regions floating above the rendered element. This was problematic because, when clicking the `x` icon on a tab that was not active, we were first activating it and then closing it.
This commit is contained in:
parent
98de269b4a
commit
82d6e606fc
1 changed files with 5 additions and 5 deletions
|
@ -689,6 +689,7 @@ impl Pane {
|
|||
let theme = cx.global::<Settings>().theme.clone();
|
||||
|
||||
enum Tabs {}
|
||||
enum Tab {}
|
||||
let pane = cx.handle();
|
||||
let tabs = MouseEventHandler::new::<Tabs, _, _>(0, cx, |mouse_state, cx| {
|
||||
let autoscroll = if mem::take(&mut self.autoscroll) {
|
||||
|
@ -717,7 +718,7 @@ impl Pane {
|
|||
style.container.border.left = false;
|
||||
}
|
||||
|
||||
EventHandler::new(
|
||||
MouseEventHandler::new::<Tab, _, _>(ix, cx, |_, cx| {
|
||||
Container::new(
|
||||
Flex::row()
|
||||
.with_child(
|
||||
|
@ -807,11 +808,10 @@ impl Pane {
|
|||
.boxed(),
|
||||
)
|
||||
.with_style(style.container)
|
||||
.boxed(),
|
||||
)
|
||||
.on_mouse_down(move |cx| {
|
||||
.boxed()
|
||||
})
|
||||
.on_mouse_down(move |_, cx| {
|
||||
cx.dispatch_action(ActivateItem(ix));
|
||||
true
|
||||
})
|
||||
.boxed()
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue