UiXmlReader padding fix

This commit is contained in:
MihailRis 2024-02-09 23:06:50 +03:00
parent 6fc312b651
commit bb1743105d
2 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,4 @@
<inventory color="#00000080" size="400,100">
<inventory color="#00000080" size="400,0">
<slots-grid cols="4" count="40"/>
<button coord="300,10">Test</button>
<button padding="10,10,10,10" coord="300,10">Test</button>
</inventory>

View File

@ -69,7 +69,13 @@ static void _readPanel(UiXmlReader& reader, xml::xmlelement element, Panel& pane
_readUINode(element, panel);
if (element->has("padding")) {
panel.setPadding(element->attr("padding").asVec4());
glm::vec4 padding = element->attr("padding").asVec4();
panel.setPadding(padding);
glm::vec2 size = panel.getSize();
panel.setSize(glm::vec2(
size.x + padding.x + padding.z,
size.y + padding.y + padding.w
));
}
if (element->has("size")) {
panel.setResizing(false);