update yoga

This commit is contained in:
2019-08-14 22:49:45 +02:00
parent a08e8c5796
commit e959fb4d91
5 changed files with 14 additions and 14 deletions

View File

@@ -955,10 +955,10 @@ void Node::clear_context()
void Node::update(float width, float height, float zoom)
{
m_zoom = zoom;
YGNodeStyleSetWidth(y_node, width / zoom);
YGNodeStyleSetHeight(y_node, height / zoom);
YGNodeStyleSetWidth(y_node, ceilf(width / zoom));
YGNodeStyleSetHeight(y_node, ceilf(height / zoom));
YGNodeCalculateLayout(y_node, YGUndefined, YGUndefined, YGDirectionLTR);
m_proj = glm::ortho(0.f, width / zoom, height / zoom, 0.f, -1.f, 1.f);
m_proj = glm::ortho(0.f, ceilf(width / zoom), ceilf(height / zoom), 0.f, -1.f, 1.f);
update_internal({ 0, 0 }, m_proj, zoom);
}
@@ -976,9 +976,9 @@ void Node::update_internal(const glm::vec2& origin, const glm::mat4& proj, float
float h = YGNodeLayoutGetHeight(y_node);
auto old_size = m_size;
glm::vec2 parent_offset = m_parent ? m_parent->m_pos_offset_childred : glm::vec2(0.f);
m_pos = glm::floor(origin + glm::vec2(x, y) + m_pos_offset + parent_offset);
m_pos_origin = glm::floor(origin + glm::vec2(x, y));
m_size = glm::floor(glm::vec2(w, h));
m_pos = /*glm::floor*/(origin + glm::vec2(x, y) + m_pos_offset + parent_offset);
m_pos_origin = /*glm::floor*/(origin + glm::vec2(x, y));
m_size = /*glm::floor*/(glm::vec2(w, h));
if (m_parent)
{