table: Avoid Table handle mouse wheel event, when it is blocked by some other element like Modal. (#261)
This commit is contained in:
parent
89414e1c3c
commit
dc3dc4a9ec
1 changed files with 3 additions and 2 deletions
|
|
@ -123,14 +123,15 @@ impl Element for ScrollableMask {
|
||||||
}
|
}
|
||||||
|
|
||||||
cx.on_mouse_event({
|
cx.on_mouse_event({
|
||||||
|
let hitbox = hitbox.clone();
|
||||||
let mouse_position = cx.mouse_position();
|
let mouse_position = cx.mouse_position();
|
||||||
let scroll_handle = self.scroll_handle.clone();
|
let scroll_handle = self.scroll_handle.clone();
|
||||||
let old_offset = scroll_handle.offset();
|
let old_offset = scroll_handle.offset();
|
||||||
let view_id = self.view.entity_id();
|
let view_id = self.view.entity_id();
|
||||||
let is_horizontal = self.axis == ScrollableAxis::Horizontal;
|
let is_horizontal = self.axis == ScrollableAxis::Horizontal;
|
||||||
|
|
||||||
move |event: &ScrollWheelEvent, _, cx| {
|
move |event: &ScrollWheelEvent, phase, cx| {
|
||||||
if bounds.contains(&mouse_position) {
|
if bounds.contains(&mouse_position) && phase.bubble() && hitbox.is_hovered(cx) {
|
||||||
let delta = event.delta.pixel_delta(line_height);
|
let delta = event.delta.pixel_delta(line_height);
|
||||||
|
|
||||||
if is_horizontal && !delta.x.is_zero() {
|
if is_horizontal && !delta.x.is_zero() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue