mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Make ui_kind a member function
This commit is contained in:
@@ -160,6 +160,19 @@ impl PanelSide {
|
|||||||
Self::Horizontal(side) => side.set_rect_height(rect, size),
|
Self::Horizontal(side) => side.set_rect_height(rect, size),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn ui_kind(self) -> UiKind {
|
||||||
|
match self {
|
||||||
|
Self::Vertical(v_side) => match v_side {
|
||||||
|
VerticalSide::Left => UiKind::LeftPanel,
|
||||||
|
VerticalSide::Right => UiKind::RightPanel,
|
||||||
|
},
|
||||||
|
Self::Horizontal(h_side) => match h_side {
|
||||||
|
HorizontalSide::Top => UiKind::TopPanel,
|
||||||
|
HorizontalSide::Bottom => UiKind::BottomPanel,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -574,21 +587,10 @@ impl Panel {
|
|||||||
// may change and round_ui() uses the size.
|
// may change and round_ui() uses the size.
|
||||||
panel_sizer.panel_rect = panel_sizer.panel_rect.round_ui();
|
panel_sizer.panel_rect = panel_sizer.panel_rect.round_ui();
|
||||||
|
|
||||||
let get_ui_kind = || match side {
|
|
||||||
PanelSide::Vertical(v_side) => match v_side {
|
|
||||||
VerticalSide::Left => UiKind::LeftPanel,
|
|
||||||
VerticalSide::Right => UiKind::RightPanel,
|
|
||||||
},
|
|
||||||
PanelSide::Horizontal(h_side) => match h_side {
|
|
||||||
HorizontalSide::Top => UiKind::TopPanel,
|
|
||||||
HorizontalSide::Bottom => UiKind::BottomPanel,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut panel_ui = ui.new_child(
|
let mut panel_ui = ui.new_child(
|
||||||
UiBuilder::new()
|
UiBuilder::new()
|
||||||
.id_salt(id)
|
.id_salt(id)
|
||||||
.ui_stack_info(UiStackInfo::new(get_ui_kind()))
|
.ui_stack_info(UiStackInfo::new(side.ui_kind()))
|
||||||
.max_rect(panel_sizer.panel_rect)
|
.max_rect(panel_sizer.panel_rect)
|
||||||
.layout(Layout::top_down(Align::Min)),
|
.layout(Layout::top_down(Align::Min)),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user