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:
parent
517ea734ee
commit
7aba9eb4b7
7 changed files with 72 additions and 45 deletions
|
@ -588,9 +588,9 @@ mod element {
|
|||
use std::{cell::RefCell, iter, rc::Rc, sync::Arc};
|
||||
|
||||
use gpui::{
|
||||
px, relative, Along, AnyElement, Axis, Bounds, CursorStyle, Element, InteractiveBounds,
|
||||
IntoElement, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, Pixels, Point,
|
||||
Size, Style, WeakView, WindowContext,
|
||||
px, relative, Along, AnyElement, Axis, Bounds, CursorStyle, Element, IntoElement,
|
||||
MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, Pixels, Point, Size, Style,
|
||||
WeakView, WindowContext,
|
||||
};
|
||||
use parking_lot::Mutex;
|
||||
use settings::Settings;
|
||||
|
@ -754,15 +754,13 @@ mod element {
|
|||
};
|
||||
|
||||
cx.with_z_index(3, |cx| {
|
||||
let interactive_handle_bounds = InteractiveBounds {
|
||||
bounds: handle_bounds,
|
||||
stacking_order: cx.stacking_order().clone(),
|
||||
};
|
||||
if interactive_handle_bounds.visibly_contains(&cx.mouse_position(), cx) {
|
||||
cx.set_cursor_style(match axis {
|
||||
if handle_bounds.contains(&cx.mouse_position()) {
|
||||
let stacking_order = cx.stacking_order().clone();
|
||||
let cursor_style = match axis {
|
||||
Axis::Vertical => CursorStyle::ResizeUpDown,
|
||||
Axis::Horizontal => CursorStyle::ResizeLeftRight,
|
||||
})
|
||||
};
|
||||
cx.set_cursor_style(cursor_style, stacking_order);
|
||||
}
|
||||
|
||||
cx.add_opaque_layer(handle_bounds);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue