Fix interaction with widgets inside selectable rows of `Table` (#4077)
* Closes https://github.com/emilk/egui/issues/4047
This commit is contained in:
parent
9096abdeec
commit
4fc0c49a6b
|
|
@ -146,7 +146,9 @@ impl<'l> StripLayout<'l> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let used_rect = self.cell(flags, max_rect, child_ui_id_source, add_cell_contents);
|
let child_ui = self.cell(flags, max_rect, child_ui_id_source, add_cell_contents);
|
||||||
|
|
||||||
|
let used_rect = child_ui.min_rect();
|
||||||
|
|
||||||
self.set_pos(max_rect);
|
self.set_pos(max_rect);
|
||||||
|
|
||||||
|
|
@ -156,7 +158,9 @@ impl<'l> StripLayout<'l> {
|
||||||
max_rect.union(used_rect)
|
max_rect.union(used_rect)
|
||||||
};
|
};
|
||||||
|
|
||||||
let response = self.ui.allocate_rect(allocation_rect, self.sense);
|
self.ui.advance_cursor_after_rect(allocation_rect);
|
||||||
|
|
||||||
|
let response = child_ui.interact(max_rect, child_ui.id(), self.sense);
|
||||||
|
|
||||||
(used_rect, response)
|
(used_rect, response)
|
||||||
}
|
}
|
||||||
|
|
@ -183,13 +187,14 @@ impl<'l> StripLayout<'l> {
|
||||||
self.ui.allocate_rect(rect, Sense::hover());
|
self.ui.allocate_rect(rect, Sense::hover());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return the Ui to which the contents where added
|
||||||
fn cell(
|
fn cell(
|
||||||
&mut self,
|
&mut self,
|
||||||
flags: StripLayoutFlags,
|
flags: StripLayoutFlags,
|
||||||
rect: Rect,
|
rect: Rect,
|
||||||
child_ui_id_source: egui::Id,
|
child_ui_id_source: egui::Id,
|
||||||
add_cell_contents: impl FnOnce(&mut Ui),
|
add_cell_contents: impl FnOnce(&mut Ui),
|
||||||
) -> Rect {
|
) -> Ui {
|
||||||
let mut child_ui =
|
let mut child_ui =
|
||||||
self.ui
|
self.ui
|
||||||
.child_ui_with_id_source(rect, self.cell_layout, child_ui_id_source);
|
.child_ui_with_id_source(rect, self.cell_layout, child_ui_id_source);
|
||||||
|
|
@ -208,7 +213,7 @@ impl<'l> StripLayout<'l> {
|
||||||
|
|
||||||
add_cell_contents(&mut child_ui);
|
add_cell_contents(&mut child_ui);
|
||||||
|
|
||||||
child_ui.min_rect()
|
child_ui
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Allocate the rect in [`Self::ui`] so that the scrollview knows about our size
|
/// Allocate the rect in [`Self::ui`] so that the scrollview knows about our size
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue