fix(bar): use truncated labels for titles

This commit introduces a new wrapper, CustomUi, which is used to
implement custom methods on top of eframe::egui::Ui.

The default ui::add_sized method always has the text in a label
centered, which is not desirable for a status bar where the layout
should be ltr.

A new function CustomUi::add_sized_left_to_right has been added to
ensure that labels can be truncated with a custom width (which requires
allocate_ui_with_layout), while also retaining the ability for the text
to be aligned to the left rather than the center of the allocated
layout.
This commit is contained in:
LGUG2Z
2024-09-21 10:20:26 -07:00
parent 1080159e68
commit 3720ce42d0
7 changed files with 114 additions and 26 deletions
+2
View File
@@ -21,6 +21,8 @@ pub struct KomobarConfig {
pub font_family: Option<String>,
/// Font size (default: 12.5)
pub font_size: Option<f32>,
/// Max label width before text truncation (default: 400.0)
pub max_label_width: Option<f32>,
/// Theme
pub theme: Option<KomobarTheme>,
/// Left side widgets (ordered left-to-right)