Fix clip bounds with nested scrollable widgets
This commit is contained in:
parent
15e15700ab
commit
67e181ce7b
1 changed files with 8 additions and 4 deletions
|
|
@ -659,6 +659,10 @@ where
|
||||||
let content_layout = layout.children().next().unwrap();
|
let content_layout = layout.children().next().unwrap();
|
||||||
let content_bounds = content_layout.bounds();
|
let content_bounds = content_layout.bounds();
|
||||||
|
|
||||||
|
let Some(visible_bounds) = bounds.intersection(viewport) else {
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
let scrollbars =
|
let scrollbars =
|
||||||
Scrollbars::new(state, self.direction, bounds, content_bounds);
|
Scrollbars::new(state, self.direction, bounds, content_bounds);
|
||||||
|
|
||||||
|
|
@ -704,7 +708,7 @@ where
|
||||||
|
|
||||||
// Draw inner content
|
// Draw inner content
|
||||||
if scrollbars.active() {
|
if scrollbars.active() {
|
||||||
renderer.with_layer(bounds, |renderer| {
|
renderer.with_layer(visible_bounds, |renderer| {
|
||||||
renderer.with_translation(
|
renderer.with_translation(
|
||||||
Vector::new(-translation.x, -translation.y),
|
Vector::new(-translation.x, -translation.y),
|
||||||
|renderer| {
|
|renderer| {
|
||||||
|
|
@ -767,9 +771,9 @@ where
|
||||||
|
|
||||||
renderer.with_layer(
|
renderer.with_layer(
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: (bounds.width + 2.0).min(viewport.width),
|
width: (visible_bounds.width + 2.0).min(viewport.width),
|
||||||
height: (bounds.height + 2.0).min(viewport.height),
|
height: (visible_bounds.height + 2.0).min(viewport.height),
|
||||||
..bounds
|
..visible_bounds
|
||||||
},
|
},
|
||||||
|renderer| {
|
|renderer| {
|
||||||
if let Some(scrollbar) = scrollbars.y {
|
if let Some(scrollbar) = scrollbars.y {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue