Skip to content

ImageNode should allow drawing over padding #24150

@viridia

Description

@viridia

Bevy version and features

0.19-dev

What you did

I created an entity with a Node and ImageNode components. The Node has a padding of 12 pixels.

What went wrong

I expected the image to draw over the padding area, not to be confined within the padding area. That is, I expected the image to extend all the way from the left border to the right border, and the top border to the bottom border.

Generally when you assign an image to a node, you do so because you want the image to serve as a background. The padding should affect the layout of children, but the ImageNode is not a child.

Additional information

I recognize that this may have backwards compatibility concerns. However, I think that being able to use the image node as a background is a much more useful choice.

For example, if I want to display a nine-sliced button with a text caption, I want to be able to use padding to create some space around the caption. With things as they currently are, I have to instead create an additional wrapper entity around the caption text, so that the wrapper can have the padding without affecting the layout of the image. This makes the button more complex than it should be.

@alice-i-cecile @ickshonpe

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UIGraphical user interfaces, styles, layouts, and widgetsC-BugAn unexpected or incorrect behaviorS-Needs-ReviewNeeds reviewer attention (from anyone!) to move forwardX-ContentiousThere are nontrivial implications that should be thought through

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions