proper widget spacing based on alignment

This commit is contained in:
Csaba
2024-11-12 20:23:33 +01:00
parent 3cd5d76644
commit be45d14f6d
12 changed files with 128 additions and 36 deletions
+9 -2
View File
@@ -1,3 +1,4 @@
use crate::bar::Alignment;
use crate::config::LabelPrefix;
use crate::widget::BarWidget;
use crate::widget::RenderConfig;
@@ -79,7 +80,13 @@ impl Storage {
}
impl BarWidget for Storage {
fn render(&mut self, ctx: &Context, ui: &mut Ui, mut config: RenderConfig) {
fn render(
&mut self,
ctx: &Context,
ui: &mut Ui,
mut config: RenderConfig,
alignment: Alignment,
) {
if self.enable {
let font_id = ctx
.style()
@@ -107,7 +114,7 @@ impl BarWidget for Storage {
TextFormat::simple(font_id.clone(), ctx.style().visuals.text_color()),
);
config.grouping.apply_on_widget(true, ui, |ui| {
config.grouping.apply_on_widget(true, alignment, ui, |ui| {
if ui
.add(
Label::new(layout_job)