Skip to content

Commit

Permalink
ui: Don’t override label gravity for text-only buttons.
Browse files Browse the repository at this point in the history
There are at least two bugs/design flaws still here, but at least this
helps with text-only buttons working as expected.
  • Loading branch information
kpreid committed Nov 28, 2024
1 parent 2863482 commit 13bcc3a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions all-is-cubes-ui/src/vui/widgets/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ impl ButtonLabel {
/// Always has as many elements as `requirements().minimum`.
fn blocks(&self, mut gravity: vui::Gravity) -> impl Iterator<Item = Block> + '_ {
// TODO: need a better plan for how gravity interacts with icons;
// this is a kludge to get okay layout of the text for now
gravity.x = vui::Align::Low;
// this is a kludge to get okay layout of the text for now, by left-aligning the
// text to meet the icon.
if self.icon.is_some() {
gravity.x = vui::Align::Low;
}

self.icon
.clone()
Expand Down
Binary file modified test-renderers/expected/ui/widget_button_action-2-all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-renderers/expected/ui/widget_button_toggle-2-all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test-renderers/expected/ui/widget_button_toggle-all.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 13bcc3a

Please sign in to comment.