table: Avoid Table handle mouse wheel event, when it is blocked by some other element like Modal. (#261)

This commit is contained in:
Jason Lee 2024-09-23 14:32:16 +08:00 committed by GitHub
parent 89414e1c3c
commit dc3dc4a9ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -123,14 +123,15 @@ impl Element for ScrollableMask {
}
cx.on_mouse_event({
let hitbox = hitbox.clone();
let mouse_position = cx.mouse_position();
let scroll_handle = self.scroll_handle.clone();
let old_offset = scroll_handle.offset();
let view_id = self.view.entity_id();
let is_horizontal = self.axis == ScrollableAxis::Horizontal;
move |event: &ScrollWheelEvent, _, cx| {
if bounds.contains(&mouse_position) {
move |event: &ScrollWheelEvent, phase, cx| {
if bounds.contains(&mouse_position) && phase.bubble() && hitbox.is_hovered(cx) {
let delta = event.delta.pixel_delta(line_height);
if is_horizontal && !delta.x.is_zero() {