Preserve tooltips requested by cached views

Co-Authored-By: Nathan <nathan@zed.dev>
Co-Authored-By: Max <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2024-01-15 19:19:27 +01:00
parent 90f4c70a82
commit 69bbcba99a
4 changed files with 49 additions and 19 deletions

View file

@ -196,7 +196,6 @@ pub struct AppContext {
pending_updates: usize,
pub(crate) actions: Rc<ActionRegistry>,
pub(crate) active_drag: Option<AnyDrag>,
pub(crate) active_tooltip: Option<AnyTooltip>,
pub(crate) next_frame_callbacks: FxHashMap<DisplayId, Vec<FrameCallback>>,
pub(crate) frame_consumers: FxHashMap<DisplayId, Task<()>>,
pub(crate) background_executor: BackgroundExecutor,
@ -258,7 +257,6 @@ impl AppContext {
flushing_effects: false,
pending_updates: 0,
active_drag: None,
active_tooltip: None,
next_frame_callbacks: FxHashMap::default(),
frame_consumers: FxHashMap::default(),
background_executor: executor,
@ -1268,8 +1266,10 @@ pub struct AnyDrag {
pub cursor_offset: Point<Pixels>,
}
/// Contains state associated with a tooltip. You'll only need this struct if you're implementing
/// tooltip behavior on a custom element. Otherwise, use [Div::tooltip].
#[derive(Clone)]
pub(crate) struct AnyTooltip {
pub struct AnyTooltip {
pub view: AnyView,
pub cursor_offset: Point<Pixels>,
}