egui
egui copied to clipboard
Margin for Image Buttons
As a user of egui
I want to have more control of how the button is styled. Currently, if we include an image on a button, the image is positioned on the far left of the button right on the edge as we can see in the following picture.
If we want to get some space between the button and the edge there are only two options, both of which are not very optimal:
- We can add a frame with a margin around the button which pushes it to the side, but the image is still on the edge of the button. Here is a picture of this alternative applied to the example above
- We can edit the image and add margin there, which might be undesireable aswell, as we just increase the image size without adding real content
So it would be nice to have some method on the button to configure it. I think an interface like image_margin(margin: Vec2)
would already do the trick.
I can get the required modification by modifying button.rs
I already filed a PR for this issue #2510