egui/crates
PrimmR ed0254288a
Update `Button` to correctly align contained image (#4891)
Similar to #4889

Updated the `ui` method of the `Button` widget so that the alignment
given by the layout is applied to the image contained in the button (if
one exists).

Currently, only the text inside the button has alignment applied to it,
and only when it is not accompanied by an image or shortcut text. Images
within buttons are always aligned to the centre left, no matter the
alignment of the containing `Ui`. This update now also applies this
alignment to an image when it has no accompanying text, which makes
buttons with an image and no text more consistent with the appearance of
ones with text and no image.

I've also made an additional change so that the vertical alignment is
now also respected when displaying some combination of image and text,
but the original horizontal alignment remains the same, so that the
image always appears left of the text. Any shortcut text now also
follows vertical alignment, but is always horizontally aligned to the
right.

Here are some comparisons of the difference between how buttons look
with different alignments, before and after this change:

### Before

![Before](https://github.com/user-attachments/assets/b5086ccb-765d-42e6-88a5-8fa427544568)

### After

![After](https://github.com/user-attachments/assets/ecf6c6aa-b1b9-4b45-be44-8c71665df5c3)

* [x] I have followed the instructions in the PR template
2024-08-05 11:19:20 +02:00
..
ecolor Remove some debug asserts (#4826) 2024-07-15 11:20:22 +02:00
eframe Fix iOS compilation of eframe (#4851) 2024-07-31 10:18:18 +02:00
egui Update `Button` to correctly align contained image (#4891) 2024-08-05 11:19:20 +02:00
egui-wgpu Upgrade winit to 0.30.2 (#4849) 2024-07-31 09:43:16 +02:00
egui-winit Fix: Backspace not working after IME input (#4912) 2024-08-05 11:09:51 +02:00
egui_demo_app upgrade to wgpu 22.0.0 (#4847) 2024-07-19 10:05:56 +02:00
egui_demo_lib Move `egui_plot` to its own repo (#4828) 2024-07-15 18:45:19 +02:00
egui_extras Return `ScrollAreaOutput` from `Table::body` (#4829) 2024-07-15 20:49:41 +02:00
egui_glow Fix missing `winit` feature in `egui_glow` (#4916) 2024-08-05 11:06:42 +02:00
egui_plot Move `egui_plot` to its own repo (#4828) 2024-07-15 18:45:19 +02:00
egui_web Fix typos (#2866) 2023-04-18 15:52:45 +02:00
emath Add `Rect::scale_from_center` (#4673) 2024-07-15 19:54:35 +02:00
epaint Move default fonts to new crate `epaint_default_fonts` (#4853) 2024-07-31 09:50:02 +02:00
epaint_default_fonts Move default fonts to new crate `epaint_default_fonts` (#4853) 2024-07-31 09:50:02 +02:00