egui icon indicating copy to clipboard operation
egui copied to clipboard

Margin for Image Buttons

Open RobWalt opened this issue 2 years ago • 2 comments

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.

image

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:

  1. 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 image
  2. 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.

RobWalt avatar Dec 26 '22 17:12 RobWalt

I can get the required modification by modifying button.rs

yunfengwangluo avatar Dec 31 '22 08:12 yunfengwangluo

I already filed a PR for this issue #2510

RobWalt avatar Jan 01 '23 00:01 RobWalt