fix pixel snapping, add loaded event, remove default border thickness

This commit is contained in:
2017-02-17 01:34:43 +00:00
parent 1c14a6d409
commit 4e3f898d4b
4 changed files with 57 additions and 56 deletions

View File

@@ -87,8 +87,8 @@ void Node::update_internal(const glm::vec2& origin, const glm::mat4& proj)
float y = YGNodeLayoutGetTop(y_node);
float w = YGNodeLayoutGetWidth(y_node);
float h = YGNodeLayoutGetHeight(y_node);
m_pos = origin + glm::vec2(x, y);
m_size = glm::vec2(w, h);
m_pos = glm::floor(origin + glm::vec2(x, y));
m_size = glm::ceil(glm::vec2(w, h));
if (parent)
{
@@ -110,8 +110,8 @@ void Node::update_internal(const glm::vec2& origin, const glm::mat4& proj)
}
glm::mat4 pivot = glm::translate(glm::vec3(.5f, .5f, 0.f));
glm::mat4 scale = glm::scale(glm::vec3(glm::ceil(m_size), 1.f));
glm::mat4 pos = glm::translate(glm::vec3(glm::floor(m_pos), 0));
glm::mat4 scale = glm::scale(glm::vec3(m_size, 1.f));
glm::mat4 pos = glm::translate(glm::vec3(m_pos, 0));
m_mvp = proj * pos * scale * pivot;
m_proj = proj;
for (auto& c : m_children)
@@ -463,6 +463,8 @@ bool LayoutManager::load(const char* path)
}
current = current->NextSiblingElement("layout");
}
if (on_loaded)
on_loaded();
return true;
}