Merge branch 'mouse-events' into project-panel-context-menu

This commit is contained in:
Antonio Scandurra 2022-05-27 12:00:06 +02:00
commit 9099c40364
26 changed files with 816 additions and 523 deletions

View file

@ -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()
})

View file

@ -165,6 +165,7 @@ impl Sidebar {
..Default::default()
})
.with_cursor_style(CursorStyle::ResizeLeftRight)
.on_mouse_down(|_, _| {}) // This prevents the mouse down event from being propagated elsewhere
.on_drag(move |delta, cx| {
let prev_width = *actual_width.borrow();
*custom_width.borrow_mut() = 0f32