summaryrefslogtreecommitdiffstats
path: root/widget/src/pane_grid.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-10-27 03:58:45 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-10-27 03:58:45 +0200
commit65823875791ecebf24d049cc0782e7475a37899b (patch)
tree1088c656ef7ad9782374952045022d2c104931b2 /widget/src/pane_grid.rs
parent8cc19de254c37d3123d5ea1b6513f1f34d35c7c8 (diff)
parentf1b1344d59fa7354615f560bd25ed01ad0c9f865 (diff)
downloadiced-65823875791ecebf24d049cc0782e7475a37899b.tar.gz
iced-65823875791ecebf24d049cc0782e7475a37899b.tar.bz2
iced-65823875791ecebf24d049cc0782e7475a37899b.zip
Merge branch 'master' into text-editor
Diffstat (limited to 'widget/src/pane_grid.rs')
-rw-r--r--widget/src/pane_grid.rs29
1 files changed, 13 insertions, 16 deletions
diff --git a/widget/src/pane_grid.rs b/widget/src/pane_grid.rs
index f868a648..2d25a543 100644
--- a/widget/src/pane_grid.rs
+++ b/widget/src/pane_grid.rs
@@ -308,7 +308,7 @@ where
.zip(layout.children())
.for_each(|(((_pane, content), state), layout)| {
content.operate(state, layout, renderer, operation);
- })
+ });
});
}
@@ -436,7 +436,7 @@ where
tree, renderer, theme, style, layout, cursor, rectangle,
);
},
- )
+ );
}
fn overlay<'b>(
@@ -606,11 +606,10 @@ pub fn update<'a, Message, T: Draggable>(
} else {
let dropped_region = contents
.zip(layout.children())
- .filter_map(|(target, layout)| {
+ .find_map(|(target, layout)| {
layout_region(layout, cursor_position)
.map(|region| (target, region))
- })
- .next();
+ });
match dropped_region {
Some(((target, _), region))
@@ -1151,21 +1150,19 @@ pub struct ResizeEvent {
* Helpers
*/
fn hovered_split<'a>(
- splits: impl Iterator<Item = (&'a Split, &'a (Axis, Rectangle, f32))>,
+ mut splits: impl Iterator<Item = (&'a Split, &'a (Axis, Rectangle, f32))>,
spacing: f32,
cursor_position: Point,
) -> Option<(Split, Axis, Rectangle)> {
- splits
- .filter_map(|(split, (axis, region, ratio))| {
- let bounds = axis.split_line_bounds(*region, *ratio, spacing);
+ splits.find_map(|(split, (axis, region, ratio))| {
+ let bounds = axis.split_line_bounds(*region, *ratio, spacing);
- if bounds.contains(cursor_position) {
- Some((*split, *axis, bounds))
- } else {
- None
- }
- })
- .next()
+ if bounds.contains(cursor_position) {
+ Some((*split, *axis, bounds))
+ } else {
+ None
+ }
+ })
}
/// The visible contents of the [`PaneGrid`]