Allow hovering over tooltips in git blame
sidebar (#10466)
This introduces a new API on `StatefulInteractiveElement` to create a tooltip that can be hovered, scrolled inside, and clicked: `.hoverable_tooltip`. Right now we only use it in the `git blame` gutter, but the plan is to use the new hover/click/scroll behavior in #10398 to introduce new git-blame-tooltips. Release Notes: - N/A --------- Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
parent
bc0c2e0cae
commit
6e1ba7e936
7 changed files with 190 additions and 52 deletions
|
@ -1,4 +1,4 @@
|
|||
use gpui::{anchored, Action, AnyView, IntoElement, Render, VisualContext};
|
||||
use gpui::{Action, AnyView, IntoElement, Render, VisualContext};
|
||||
use settings::Settings;
|
||||
use theme::ThemeSettings;
|
||||
|
||||
|
@ -90,18 +90,17 @@ pub fn tooltip_container<V>(
|
|||
f: impl FnOnce(Div, &mut ViewContext<V>) -> Div,
|
||||
) -> impl IntoElement {
|
||||
let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone();
|
||||
// padding to avoid mouse cursor
|
||||
anchored().child(
|
||||
div().pl_2().pt_2p5().child(
|
||||
v_flex()
|
||||
.elevation_2(cx)
|
||||
.font(ui_font)
|
||||
.text_ui()
|
||||
.text_color(cx.theme().colors().text)
|
||||
.py_1()
|
||||
.px_2()
|
||||
.map(|el| f(el, cx)),
|
||||
),
|
||||
|
||||
// padding to avoid tooltip appearing right below the mouse cursor
|
||||
div().pl_2().pt_2p5().child(
|
||||
v_flex()
|
||||
.elevation_2(cx)
|
||||
.font(ui_font)
|
||||
.text_ui()
|
||||
.text_color(cx.theme().colors().text)
|
||||
.py_1()
|
||||
.px_2()
|
||||
.map(|el| f(el, cx)),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue