Use Option::filter instead of and_then in scrollable
This commit is contained in:
parent
412e15b170
commit
1c26440f0b
1 changed files with 6 additions and 14 deletions
|
|
@ -1203,21 +1203,13 @@ impl Scrollbars {
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let offset = state.offset(direction, bounds, content_bounds);
|
let offset = state.offset(direction, bounds, content_bounds);
|
||||||
|
|
||||||
let show_scrollbar_x = direction.horizontal().and_then(|h| {
|
let show_scrollbar_x = direction
|
||||||
if content_bounds.width > bounds.width {
|
.horizontal()
|
||||||
Some(h)
|
.filter(|_| content_bounds.width > bounds.width);
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let show_scrollbar_y = direction.vertical().and_then(|v| {
|
let show_scrollbar_y = direction
|
||||||
if content_bounds.height > bounds.height {
|
.vertical()
|
||||||
Some(v)
|
.filter(|_| content_bounds.height > bounds.height);
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let y_scrollbar = if let Some(vertical) = show_scrollbar_y {
|
let y_scrollbar = if let Some(vertical) = show_scrollbar_y {
|
||||||
let Properties {
|
let Properties {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue