|
|
|
@ -24,6 +24,10 @@ MultiComponent::MultiComponent(const float rawX, const float rawY, const float r
@@ -24,6 +24,10 @@ MultiComponent::MultiComponent(const float rawX, const float rawY, const float r
|
|
|
|
|
this->windowWidth = passedWindowWidth; |
|
|
|
|
this->windowHeight = passedWindowHeight; |
|
|
|
|
|
|
|
|
|
this->onResize=[this](int w, int h) { |
|
|
|
|
this->resize(w, h); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// we need a mouseout to mouseout our hovercomponent
|
|
|
|
|
this->onMouseout=[this]() { |
|
|
|
|
if (this->hoverComponent && this->hoverComponent->onMouseout) { |
|
|
|
@ -265,7 +269,13 @@ void MultiComponent::updateMouse() {
@@ -265,7 +269,13 @@ void MultiComponent::updateMouse() {
|
|
|
|
|
if (this->hoverComponent->onClick) { |
|
|
|
|
glfwSetCursor(this->win->window, this->win->cursorHand); |
|
|
|
|
} else { |
|
|
|
|
glfwSetCursor(this->win->window, this->win->cursorIbeam); |
|
|
|
|
TextComponent *text=dynamic_cast<TextComponent *>(this->hoverComponent.get()); |
|
|
|
|
InputComponent *ab=dynamic_cast<InputComponent *>(this->hoverComponent.get()); |
|
|
|
|
if (text || ab) { |
|
|
|
|
glfwSetCursor(this->win->window, this->win->cursorIbeam); |
|
|
|
|
} else { |
|
|
|
|
glfwSetCursor(this->win->window, this->win->cursorArrow); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
@ -279,7 +289,8 @@ void MultiComponent::resize(const int passedWindowWidth, const int passedWindowH
@@ -279,7 +289,8 @@ void MultiComponent::resize(const int passedWindowWidth, const int passedWindowH
|
|
|
|
|
//std::cout << "MultiComponent::resize - relaying out. Name: " << name << std::endl;
|
|
|
|
|
windowWidth = passedWindowWidth; |
|
|
|
|
windowHeight = passedWindowHeight; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const std::clock_t begin = clock(); |
|
|
|
|
// for each layer
|
|
|
|
|
for(auto layer: this->layers) { |
|
|
|
|
//Component::printComponentTree(rootComponent, 0);
|
|
|
|
@ -288,8 +299,18 @@ void MultiComponent::resize(const int passedWindowWidth, const int passedWindowH
@@ -288,8 +299,18 @@ void MultiComponent::resize(const int passedWindowWidth, const int passedWindowH
|
|
|
|
|
layer->windowHeight = passedWindowHeight; |
|
|
|
|
// relayout it out with new sizes
|
|
|
|
|
layer->layout(); |
|
|
|
|
// in the case of Document, we need to re-assess the scroll limits
|
|
|
|
|
/*
|
|
|
|
|
// recalculate scroll max by calculating how many screens are in the rootComponent's Height
|
|
|
|
|
if (transformMatrix[13]>std::max((rootComponent->height)/(windowHeight)*2.0f, 2.0f)) { |
|
|
|
|
transformMatrix[13]=std::max((rootComponent->height)/(windowHeight)*2.0f, 2.0f); |
|
|
|
|
transformMatrixDirty = true; |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
//Component::printComponentTree(rootComponent, 0);
|
|
|
|
|
} |
|
|
|
|
const std::clock_t end = clock(); |
|
|
|
|
std::cout << "MultiComponent::resize - resized layers in: " << std::fixed << ((static_cast<double>(end - begin)) / CLOCKS_PER_SEC) << std::scientific << " seconds" << std::endl; |
|
|
|
|
|
|
|
|
|
//renderDirty = true;
|
|
|
|
|
// should we mark win->renderDirty = true?
|
|
|
|
|