Skip to content
Snippets Groups Projects
Commit d60ab25c authored by gyroninja's avatar gyroninja
Browse files

shift empty components on resize

parent ae14030f
No related branches found
No related tags found
No related merge requests found
......@@ -136,6 +136,7 @@ void TextComponent::render() {
}
void TextComponent::resize(const int rawX, const int rawY, const int windowWidth, const int windowHeight) {
y = rawY;
rasterize(rawX, rawY, windowWidth, windowHeight);
verticesDirty = true;
}
......
......@@ -59,6 +59,7 @@ bool Window::initGLFW() {
boxComponent->resize(width, height);
}
thiz->resizeComponentTree(thiz->rootComponent, width, height);
thiz->printComponentTree(thiz->rootComponent, 0);
});
glfwSetScrollCallback(window, [](GLFWwindow *win, double xOffset, double yOffset) {
Window *thiz = reinterpret_cast<Window*>(glfwGetWindowUserPointer(win));
......@@ -235,6 +236,9 @@ void Window::resizeComponentTree(const std::shared_ptr<Component> &component, co
}
}
else {
if (component->parent) {
component->y = component->parent->y - component->parent->height;
}
component->height = 0;
}
for (std::shared_ptr<Component> child : component->children) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment