Sdk/Widgets: Properly fixes padding

This commit is contained in:
Lynix
2017-01-18 23:06:31 +01:00
parent 5752792565
commit c1dfc5c4b8
7 changed files with 44 additions and 34 deletions

View File

@@ -40,12 +40,14 @@ namespace Ndk
{
BaseWidget::Layout();
Nz::Vector2f origin = GetContentOrigin();
const Nz::Vector2f& contentSize = GetContentSize();
m_gradientEntity->GetComponent<NodeComponent>().SetPosition(origin);
m_gradientSprite->SetSize(contentSize);
Nz::Boxf textBox = m_textEntity->GetComponent<GraphicsComponent>().GetBoundingVolume().aabb;
m_textEntity->GetComponent<NodeComponent>().SetPosition(contentSize.x / 2 - textBox.width / 2, contentSize.y / 2 - textBox.height / 2);
m_textEntity->GetComponent<NodeComponent>().SetPosition(origin.x + contentSize.x / 2 - textBox.width / 2, origin.y + contentSize.y / 2 - textBox.height / 2);
}
void ButtonWidget::OnMouseButtonRelease(int /*x*/, int /*y*/, Nz::Mouse::Button button)