fix text node pad and font height bounds

This commit is contained in:
2019-11-29 12:16:20 +01:00
parent 26257e5a37
commit 2aadf9e92c
4 changed files with 13 additions and 9 deletions

View File

@@ -123,17 +123,17 @@ void NodeText::update_layout()
auto pad = GetPadding();
if (auto_width)
{
YGNodeStyleSetWidth(y_node, m_text_mesh.bb.x);
m_size.x = m_text_mesh.bb.x;
YGNodeStyleSetWidth(y_node, m_text_mesh.bb.x + (pad[1] + pad[3]));
m_size.x = m_text_mesh.bb.x + (pad[1] + pad[3]);
}
if (auto_height)
{
YGNodeStyleSetHeight(y_node, m_text_mesh.bb.y);
m_size.y = m_text_mesh.bb.y;
YGNodeStyleSetHeight(y_node, m_text_mesh.bb.y + (pad[0] + pad[2]));
m_size.y = m_text_mesh.bb.y + (pad[0] + pad[2]);
}
float h = m_size.y - (pad[1] + pad[3]);
float w = m_size.x - (pad[0] + pad[2]);
float w = m_size.x - (pad[1] + pad[3]);
float h = m_size.y - (pad[0] + pad[2]);
if (m_text_align_v == TextAlign::Begin)
m_off.y = pad[0];