Skip to content

StyleBoxTexture Texture Margin act like a MarginContainer #110186

@xDovos

Description

@xDovos

Tested versions

4.4.1 stable
4.5.Beta7

System information

Godot v4.5.beta7 - Windows 10 (build 19045) - Multi-window, 2 monitors - OpenGL 3 (Compatibility) - NVIDIA GeForce RTX 2060 SUPER (NVIDIA; 32.0.15.8115) - Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz (8 threads) - 63.91 GiB memory

Issue description

after finally getting started on working with themes, i start to run into one issue after another. this one is what i understand the least.

Image why is the TEXTURE margin of a background StyleBoxTexture acting like a MarginContainer placed between the node and it's sub nodes? it should be purely on the texture like for a NinePatchRect and ignore the children like the label for the button. Image Image

the top one is a button and the bottom one is a NinePatchRect + Label.
both have the same texture and regionRect for the margin and both are at their minimum height.
i would expect that the theme behaves more like the NinePatchRect and maybe has a separate MarginContainer margin for the sub children that can be configured that doesn't affect the background texture.
the thing that i find weird is that the Expand Margins of the StyleBoxContainer are purely texture based and don't affect anything else of the node. i would expect both of them to behave the same as it is texture settings and not node settings.
btw, this also shifts the Center position of the Label to the side if the needed margins for the texture aren't symetrical for the texture.

Steps to reproduce

  • make a control scene
  • add button
  • add a theme
  • give the button in the theme a StyleBoxTexture for the Normal style
  • set the texture and texture Margin like shown above
  • add a NinePatchRect
  • add the texture
  • set the same margins
  • add a Label as Child.
  • set the label text as Centered.

Minimal reproduction project (MRP)

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions