ZIm/crates/gpui/examples
Michael Sloan 9086784038
gpui: Support hitbox blocking mouse interaction except scrolling (#31712)
tl;dr: This adds `.block_mouse_except_scroll()` which should typically
be used instead of `.occlude()` for cases when the mouse shouldn't
interact with elements drawn below an element. The rationale for
treating scroll events differently:

* Mouse move / click / styles / tooltips are for elements the user is
interacting with directly.
* Mouse scroll events are about finding the current outer scroll
container.

Most use of `occlude` should probably be switched to this, but I figured
I'd derisk this change by minimizing behavior changes to just the 3 uses
of `block_mouse_except_scroll`.

GPUI changes:

* Added `InteractiveElement::block_mouse_except_scroll()`, and removes
`stop_mouse_events_except_scroll()`

* Added `Hitbox::should_handle_scroll()` to be used when handling scroll
wheel events.

* `Window::insert_hitbox` now takes `HitboxBehavior` instead of
`occlude: bool`.

    - `false` for that bool is now `HitboxBehavior::Normal`.

    - `true` for that bool is now `HitboxBehavior::BlockMouse`.
    
    - The new mode is `HitboxBehavior::BlockMouseExceptScroll`.

* Removes `Default` impl for `HitboxId` since applications should not
manually create `HitboxId(0)`.

Release Notes:

- N/A
2025-05-29 21:41:15 +00:00
..
image chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
svg chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
animation.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
data_table.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
drag_drop.rs gpui: Keep drag cursor style when dragging (#24797) 2025-04-10 23:54:12 +00:00
gif_viewer.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
gradient.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
hello_world.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
image_gallery.rs Use image cache to stop leaking images (#29452) 2025-04-29 19:30:16 +00:00
image_loading.rs Use anyhow more idiomatically (#31052) 2025-05-20 23:06:07 +00:00
input.rs gpui: Activate the window example along with the Quit action (#30790) 2025-05-26 10:10:35 +03:00
on_window_close_quit.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
opacity.rs Add initial element inspector for Zed development (#31315) 2025-05-23 23:08:59 +00:00
ownership_post.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
painting.rs gpui: Add more shapes for PathBuilder (#30904) 2025-05-26 12:49:42 +03:00
pattern.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
set_menus.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
shadow.rs Add initial element inspector for Zed development (#31315) 2025-05-23 23:08:59 +00:00
text.rs gpui: Add a standard text example (#30747) 2025-05-16 17:35:44 +02:00
text_layout.rs Revert buggy pr (#28554) 2025-04-10 18:58:36 -06:00
text_wrapper.rs Add initial element inspector for Zed development (#31315) 2025-05-23 23:08:59 +00:00
uniform_list.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
window.rs gpui: Activate the window example along with the Quit action (#30790) 2025-05-26 10:10:35 +03:00
window_positioning.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
window_shadow.rs gpui: Support hitbox blocking mouse interaction except scrolling (#31712) 2025-05-29 21:41:15 +00:00