Only update hover state on scroll
This commit is contained in:
parent
76842eed31
commit
1f2d18e691
1 changed files with 2 additions and 18 deletions
|
@ -693,12 +693,6 @@ impl<S: ScrollbarVisibilitySetting, T: ScrollableHandle> ScrollbarState<S, T> {
|
||||||
.is_some_and(|state| state.parent_bounds.contains(position))
|
.is_some_and(|state| state.parent_bounds.contains(position))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn thumb_for_position(&self, position: &Point<Pixels>) -> Option<&ScrollbarLayout> {
|
|
||||||
self.last_prepaint_state
|
|
||||||
.as_ref()
|
|
||||||
.and_then(|state| state.thumb_for_position(position))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn hit_for_position(&self, position: &Point<Pixels>) -> Option<&ScrollbarLayout> {
|
fn hit_for_position(&self, position: &Point<Pixels>) -> Option<&ScrollbarLayout> {
|
||||||
self.last_prepaint_state
|
self.last_prepaint_state
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -1169,19 +1163,9 @@ impl<S: ScrollbarVisibilitySetting, T: ScrollableHandle> Element for ScrollbarEl
|
||||||
let state = self.state.clone();
|
let state = self.state.clone();
|
||||||
|
|
||||||
move |event: &ScrollWheelEvent, phase, window, cx| {
|
move |event: &ScrollWheelEvent, phase, window, cx| {
|
||||||
if phase.capture()
|
if phase.capture() {
|
||||||
&& state.read(cx).thumb_for_position(&event.position).is_some()
|
|
||||||
{
|
|
||||||
let scroll_handle = state.read(cx).scroll_handle();
|
|
||||||
let current_offset = scroll_handle.offset();
|
|
||||||
state.update(cx, |state, cx| {
|
state.update(cx, |state, cx| {
|
||||||
state.set_offset(
|
state.update_hovered_thumb(&event.position, window, cx)
|
||||||
current_offset + event.delta.pixel_delta(window.line_height()),
|
|
||||||
window,
|
|
||||||
cx,
|
|
||||||
);
|
|
||||||
state.show_scrollbars(window, cx);
|
|
||||||
cx.stop_propagation();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue