Introduce a short-term solution for flickering (#8542)

This uses bounds checking alone to determine hover state to avoid
flicker. It's a short-term solution because the rendering is incorrect.
We think this is better than flickering though and buys us some time as
we work on a more robust solution overall.

Release Notes:

- Fixed flickering when hovering.

---------

Co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2024-02-28 17:57:20 +01:00
committed by GitHub
co-authored by Nathan
parent 517ea734ee
commit 7aba9eb4b7
7 changed files with 72 additions and 45 deletions
+12 -3
View File
@@ -923,9 +923,15 @@ impl EditorElement {
.as_ref()
.is_some_and(|hovered_link_state| !hovered_link_state.links.is_empty())
{
cx.set_cursor_style(CursorStyle::PointingHand);
cx.set_cursor_style(
CursorStyle::PointingHand,
interactive_text_bounds.stacking_order.clone(),
);
} else {
cx.set_cursor_style(CursorStyle::IBeam);
cx.set_cursor_style(
CursorStyle::IBeam,
interactive_text_bounds.stacking_order.clone(),
);
}
}
@@ -1552,7 +1558,10 @@ impl EditorElement {
};
let mut mouse_position = cx.mouse_position();
if interactive_track_bounds.visibly_contains(&mouse_position, cx) {
cx.set_cursor_style(CursorStyle::Arrow);
cx.set_cursor_style(
CursorStyle::Arrow,
interactive_track_bounds.stacking_order.clone(),
);
}
cx.on_mouse_event({