mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
add 'onfocus' ui event & optimize container:add
This commit is contained in:
parent
8e8cabf2d1
commit
1e90115a26
9 changed files with 31 additions and 10 deletions
|
|
@ -71,6 +71,10 @@ void Container::mouseRelease(int x, int y) {
|
|||
}
|
||||
|
||||
void Container::act(float delta) {
|
||||
if (mustRefresh) {
|
||||
refresh();
|
||||
mustRefresh = false;
|
||||
}
|
||||
for (const auto& node : nodes) {
|
||||
if (node->isVisible()) {
|
||||
node->act(delta);
|
||||
|
|
@ -162,7 +166,7 @@ void Container::add(const std::shared_ptr<UINode>& node) {
|
|||
nodes.push_back(node);
|
||||
node->setParent(this);
|
||||
node->reposition();
|
||||
refresh();
|
||||
mustRefresh = true;
|
||||
}
|
||||
|
||||
void Container::add(const std::shared_ptr<UINode>& node, glm::vec2 pos) {
|
||||
|
|
@ -202,7 +206,6 @@ void Container::listenInterval(float interval, ontimeout callback, int repeat) {
|
|||
|
||||
void Container::setSize(glm::vec2 size) {
|
||||
if (size == getSize()) {
|
||||
refresh();
|
||||
return;
|
||||
}
|
||||
UINode::setSize(size);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue