update splitbox refresh method
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
#include "SplitBox.hpp"
|
#include "SplitBox.hpp"
|
||||||
|
|
||||||
|
#include "util/stack_vector.hpp"
|
||||||
|
|
||||||
using namespace gui;
|
using namespace gui;
|
||||||
|
|
||||||
SplitBox::SplitBox(GUI& gui, const glm::vec2& size, float splitPos, Orientation orientation)
|
SplitBox::SplitBox(GUI& gui, const glm::vec2& size, float splitPos, Orientation orientation)
|
||||||
@@ -28,18 +30,31 @@ void SplitBox::mouseMove(int x, int y) {
|
|||||||
void SplitBox::refresh() {
|
void SplitBox::refresh() {
|
||||||
Container::refresh();
|
Container::refresh();
|
||||||
|
|
||||||
if (nodes.empty()) {
|
util::stack_vector<UINode*, 2> visibleNodes;
|
||||||
|
|
||||||
|
for (const auto& node : nodes) {
|
||||||
|
if (!node->isVisible()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
visibleNodes.push_back(node.get());
|
||||||
|
if (visibleNodes.full()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (visibleNodes.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 size = getSize();
|
glm::vec2 size = getSize();
|
||||||
if (nodes.size() == 1) {
|
if (visibleNodes.size() == 1) {
|
||||||
auto node = nodes.at(0);
|
auto node = visibleNodes.at(0);
|
||||||
node->setPos(glm::vec2());
|
node->setPos(glm::vec2());
|
||||||
node->setSize(size);
|
node->setSize(size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto nodeA = nodes.at(0);
|
auto nodeA = visibleNodes.at(0);
|
||||||
auto nodeB = nodes.at(1);
|
auto nodeB = visibleNodes.at(1);
|
||||||
|
|
||||||
float sepRadius = interval / 2.0f;
|
float sepRadius = interval / 2.0f;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user