Decide whether to clip to visible bounds on a per-element basis

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-10-11 17:05:13 +02:00
parent eb711cde53
commit 45d118f96f
8 changed files with 18 additions and 12 deletions

View file

@ -261,7 +261,8 @@ impl Element for List {
scroll_top: &mut ListOffset,
cx: &mut PaintContext,
) {
cx.scene.push_layer(Some(bounds));
let visible_bounds = visible_bounds.intersection(bounds).unwrap_or_default();
cx.scene.push_layer(Some(visible_bounds));
cx.scene
.push_mouse_region(MouseRegion::new::<Self>(10, 0, bounds).on_scroll({