Fix bug in panel button dispatch
This commit is contained in:
parent
5065804388
commit
5e4a9abd09
1 changed files with 14 additions and 6 deletions
|
@ -503,13 +503,21 @@ impl View for PanelButtons {
|
||||||
})
|
})
|
||||||
.with_cursor_style(CursorStyle::PointingHand)
|
.with_cursor_style(CursorStyle::PointingHand)
|
||||||
.on_click(MouseButton::Left, {
|
.on_click(MouseButton::Left, {
|
||||||
|
let tooltip_action =
|
||||||
|
tooltip_action.as_ref().map(|action| action.boxed_clone());
|
||||||
move |_, this, cx| {
|
move |_, this, cx| {
|
||||||
if let Some(workspace) = this.workspace.upgrade(cx) {
|
if let Some(tooltip_action) = &tooltip_action {
|
||||||
cx.window_context().defer(move |cx| {
|
let window_id = cx.window_id();
|
||||||
workspace.update(cx, |workspace, cx| {
|
let view_id = this.workspace.id();
|
||||||
workspace.toggle_panel(dock_position, panel_ix, cx)
|
let tooltip_action = tooltip_action.boxed_clone();
|
||||||
});
|
cx.spawn(|_, mut cx| async move {
|
||||||
});
|
cx.dispatch_action(
|
||||||
|
window_id,
|
||||||
|
view_id,
|
||||||
|
&*tooltip_action,
|
||||||
|
)
|
||||||
|
.ok();
|
||||||
|
}).detach();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue