Skip to content

Commit

Permalink
Merge pull request #2611 from tarkah/fix/ignore-out-of-viewport-text
Browse files Browse the repository at this point in the history
Don't fill out of viewport text
  • Loading branch information
hecrj authored Oct 2, 2024
2 parents 5ee82b2 + d40aa64 commit d5f278b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
19 changes: 8 additions & 11 deletions widget/src/column.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,24 +320,21 @@ where
viewport: &Rectangle,
) {
if let Some(clipped_viewport) = layout.bounds().intersection(viewport) {
let viewport = if self.clip {
&clipped_viewport
} else {
viewport
};

for ((child, state), layout) in self
.children
.iter()
.zip(&tree.children)
.zip(layout.children())
.filter(|(_, layout)| layout.bounds().intersects(viewport))
{
child.as_widget().draw(
state,
renderer,
theme,
style,
layout,
cursor,
if self.clip {
&clipped_viewport
} else {
viewport
},
state, renderer, theme, style, layout, cursor, viewport,
);
}
}
Expand Down
19 changes: 8 additions & 11 deletions widget/src/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,24 +316,21 @@ where
viewport: &Rectangle,
) {
if let Some(clipped_viewport) = layout.bounds().intersection(viewport) {
let viewport = if self.clip {
&clipped_viewport
} else {
viewport
};

for ((child, state), layout) in self
.children
.iter()
.zip(&tree.children)
.zip(layout.children())
.filter(|(_, layout)| layout.bounds().intersects(viewport))
{
child.as_widget().draw(
state,
renderer,
theme,
style,
layout,
cursor,
if self.clip {
&clipped_viewport
} else {
viewport
},
state, renderer, theme, style, layout, cursor, viewport,
);
}
}
Expand Down

0 comments on commit d5f278b

Please sign in to comment.