Use theme in TabMenu

This commit is contained in:
mars 2022-11-18 13:42:18 -07:00
parent 3f7ebeaf7e
commit ce7d641795
1 changed files with 6 additions and 7 deletions

View File

@ -224,6 +224,7 @@ pub struct TabMenu {
impl TabMenu {
const HEAD_RADIUS: f32 = 5.0;
const HEAD_HEIGHT: f32 = 15.0;
const HEAD_COLOR: Color = THEME.palette.surface;
const TAB_WIDTH: f32 = 15.0;
const TAB_HEIGHT: f32 = 25.0;
const TAB_NUM: usize = 6;
@ -235,9 +236,9 @@ impl TabMenu {
radius: Self::HEAD_HEIGHT * 0.25,
spacing: Self::HEAD_HEIGHT * 0.1,
thickness: Self::HEAD_HEIGHT * 0.05,
body_color: Color::WHITE,
ring_color: Color::BLACK,
icon_color: Color::BLACK,
body_color: Self::HEAD_COLOR,
ring_color: THEME.palette.black,
icon_color: THEME.palette.black,
};
const HEAD_BUTTON_MARGIN: f32 = Self::HEAD_HEIGHT / 2.0;
@ -348,20 +349,18 @@ impl Container for TabMenu {
}
fn draw(&mut self, ctx: &DrawContext) {
let head_color = Color::WHITE;
ctx.draw_partially_rounded_rect(
CornerFlags::BOTTOM_RIGHT,
self.separator_rect,
Self::INNER_RADIUS,
head_color,
Self::HEAD_COLOR,
);
ctx.draw_partially_rounded_rect(
CornerFlags::TOP,
self.head_rect,
Self::HEAD_RADIUS,
head_color,
Self::HEAD_COLOR,
);
}
}