egui_extras Table/Strip: fix some spacing bugs
This commit is contained in:
parent
c88e1f8b29
commit
772ef84242
2 changed files with 5 additions and 8 deletions
|
@ -121,11 +121,11 @@ impl<'l> StripLayout<'l> {
|
||||||
pub fn end_line(&mut self) {
|
pub fn end_line(&mut self) {
|
||||||
match self.direction {
|
match self.direction {
|
||||||
CellDirection::Horizontal => {
|
CellDirection::Horizontal => {
|
||||||
self.cursor.y = self.max.y;
|
self.cursor.y = self.max.y + self.ui.spacing().item_spacing.y;
|
||||||
self.cursor.x = self.rect.left();
|
self.cursor.x = self.rect.left();
|
||||||
}
|
}
|
||||||
CellDirection::Vertical => {
|
CellDirection::Vertical => {
|
||||||
self.cursor.x = self.max.x;
|
self.cursor.x = self.max.x + self.ui.spacing().item_spacing.x;
|
||||||
self.cursor.y = self.rect.top();
|
self.cursor.y = self.rect.top();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,10 +135,7 @@ impl<'l> StripLayout<'l> {
|
||||||
let mut child_ui = self.ui.child_ui(rect, *self.ui.layout());
|
let mut child_ui = self.ui.child_ui(rect, *self.ui.layout());
|
||||||
|
|
||||||
if self.clip {
|
if self.clip {
|
||||||
let mut clip_rect = child_ui.clip_rect();
|
child_ui.set_clip_rect(child_ui.clip_rect().intersect(rect));
|
||||||
clip_rect.min = clip_rect.min.max(rect.min);
|
|
||||||
clip_rect.max = clip_rect.max.min(rect.max);
|
|
||||||
child_ui.set_clip_rect(clip_rect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_contents(&mut child_ui);
|
add_contents(&mut child_ui);
|
||||||
|
|
|
@ -86,7 +86,7 @@ impl<'a> StripBuilder<'a> {
|
||||||
F: for<'b> FnOnce(Strip<'a, 'b>),
|
F: for<'b> FnOnce(Strip<'a, 'b>),
|
||||||
{
|
{
|
||||||
let widths = self.sizing.to_lengths(
|
let widths = self.sizing.to_lengths(
|
||||||
self.ui.available_rect_before_wrap().width() - self.ui.spacing().item_spacing.x,
|
self.ui.available_rect_before_wrap().width(),
|
||||||
self.ui.spacing().item_spacing.x,
|
self.ui.spacing().item_spacing.x,
|
||||||
);
|
);
|
||||||
let mut layout = StripLayout::new(self.ui, CellDirection::Horizontal, self.clip);
|
let mut layout = StripLayout::new(self.ui, CellDirection::Horizontal, self.clip);
|
||||||
|
@ -107,7 +107,7 @@ impl<'a> StripBuilder<'a> {
|
||||||
F: for<'b> FnOnce(Strip<'a, 'b>),
|
F: for<'b> FnOnce(Strip<'a, 'b>),
|
||||||
{
|
{
|
||||||
let heights = self.sizing.to_lengths(
|
let heights = self.sizing.to_lengths(
|
||||||
self.ui.available_rect_before_wrap().height() - self.ui.spacing().item_spacing.y,
|
self.ui.available_rect_before_wrap().height(),
|
||||||
self.ui.spacing().item_spacing.y,
|
self.ui.spacing().item_spacing.y,
|
||||||
);
|
);
|
||||||
let mut layout = StripLayout::new(self.ui, CellDirection::Vertical, self.clip);
|
let mut layout = StripLayout::new(self.ui, CellDirection::Vertical, self.clip);
|
||||||
|
|
Loading…
Reference in a new issue