fix text node pad and font height bounds
This commit is contained in:
@@ -571,6 +571,7 @@
|
|||||||
<Xml Include="data\dialogs\panel-quick.xml" />
|
<Xml Include="data\dialogs\panel-quick.xml" />
|
||||||
<Xml Include="data\dialogs\panel-stroke.xml" />
|
<Xml Include="data\dialogs\panel-stroke.xml" />
|
||||||
<Xml Include="data\dialogs\progress-bar.xml" />
|
<Xml Include="data\dialogs\progress-bar.xml" />
|
||||||
|
<Xml Include="data\dialogs\remote-page.xml" />
|
||||||
<Xml Include="data\dialogs\settings.xml" />
|
<Xml Include="data\dialogs\settings.xml" />
|
||||||
<Xml Include="data\dialogs\usermanual.xml" />
|
<Xml Include="data\dialogs\usermanual.xml" />
|
||||||
<Xml Include="data\layout.xml">
|
<Xml Include="data\layout.xml">
|
||||||
|
|||||||
@@ -737,6 +737,9 @@
|
|||||||
<Xml Include="data\dialogs\panel-animation.xml">
|
<Xml Include="data\dialogs\panel-animation.xml">
|
||||||
<Filter>extras\dialogs</Filter>
|
<Filter>extras\dialogs</Filter>
|
||||||
</Xml>
|
</Xml>
|
||||||
|
<Xml Include="data\dialogs\remote-page.xml">
|
||||||
|
<Filter>extras\dialogs</Filter>
|
||||||
|
</Xml>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="data\shaders\texture.glsl">
|
<None Include="data\shaders\texture.glsl">
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ void TextMesh::update(kFont id, const std::string& text)
|
|||||||
{
|
{
|
||||||
font_id = id;
|
font_id = id;
|
||||||
auto& f = FontManager::get(id);
|
auto& f = FontManager::get(id);
|
||||||
float spacing = f.bounds.w - f.bounds.y;
|
float spacing = (f.bounds.w - f.bounds.y);
|
||||||
float avg_width = f.bounds.z - f.bounds.x;
|
float avg_width = f.bounds.z - f.bounds.x;
|
||||||
cur_box = glm::vec4(0, f.bounds.y, 5, spacing);
|
cur_box = glm::vec4(0, f.bounds.y, 5, spacing);
|
||||||
|
|
||||||
@@ -200,8 +200,8 @@ void TextMesh::update(kFont id, const std::string& text)
|
|||||||
idx.push_back(n + 0);
|
idx.push_back(n + 0);
|
||||||
idx.push_back(n + 2);
|
idx.push_back(n + 2);
|
||||||
idx.push_back(n + 3);
|
idx.push_back(n + 3);
|
||||||
bbmin = glm::min(bbmin, xy(f.bounds));
|
bbmin = glm::min(bbmin, glm::floor(xy(f.bounds)));
|
||||||
bbmax = glm::max(bbmax, { q.x1 / f.scale, y + f.bounds.w });
|
bbmax = glm::max(bbmax, glm::ceil(glm::vec2(q.x1 / f.scale, y / f.scale + f.bounds.w)));
|
||||||
if (max_width > 0 && q.x1 / f.scale + 5 > max_width * f.scale)
|
if (max_width > 0 && q.x1 / f.scale + 5 > max_width * f.scale)
|
||||||
cur_box = glm::vec4(0, (y + spacing * f.scale) / f.scale + f.bounds.y, 5, spacing);
|
cur_box = glm::vec4(0, (y + spacing * f.scale) / f.scale + f.bounds.y, 5, spacing);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -123,17 +123,17 @@ void NodeText::update_layout()
|
|||||||
auto pad = GetPadding();
|
auto pad = GetPadding();
|
||||||
if (auto_width)
|
if (auto_width)
|
||||||
{
|
{
|
||||||
YGNodeStyleSetWidth(y_node, 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;
|
m_size.x = m_text_mesh.bb.x + (pad[1] + pad[3]);
|
||||||
}
|
}
|
||||||
if (auto_height)
|
if (auto_height)
|
||||||
{
|
{
|
||||||
YGNodeStyleSetHeight(y_node, 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;
|
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[1] + pad[3]);
|
||||||
float w = m_size.x - (pad[0] + pad[2]);
|
float h = m_size.y - (pad[0] + pad[2]);
|
||||||
|
|
||||||
if (m_text_align_v == TextAlign::Begin)
|
if (m_text_align_v == TextAlign::Begin)
|
||||||
m_off.y = pad[0];
|
m_off.y = pad[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user