Fixed world name label behaviour
This commit is contained in:
@@ -78,9 +78,20 @@ bool UINode::isInside(glm::vec2 pos) {
|
||||
}
|
||||
|
||||
shared_ptr<UINode> UINode::getAt(vec2 pos, shared_ptr<UINode> self) {
|
||||
if (!interactive) {
|
||||
return nullptr;
|
||||
}
|
||||
return isInside(pos) ? self : nullptr;
|
||||
}
|
||||
|
||||
bool UINode::isInteractive() const {
|
||||
return interactive;
|
||||
}
|
||||
|
||||
void UINode::setInteractive(bool flag) {
|
||||
interactive = flag;
|
||||
}
|
||||
|
||||
vec2 UINode::calcCoord() const {
|
||||
if (parent) {
|
||||
return coord + parent->calcCoord() + parent->contentOffset();
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace gui {
|
||||
bool hover_ = false;
|
||||
bool pressed_ = false;
|
||||
bool focused_ = false;
|
||||
bool interactive = true;
|
||||
Align align_ = Align::left;
|
||||
UINode* parent = nullptr;
|
||||
UINode(glm::vec2 coord, glm::vec2 size);
|
||||
@@ -74,9 +75,12 @@ namespace gui {
|
||||
virtual bool isInside(glm::vec2 pos);
|
||||
virtual std::shared_ptr<UINode> getAt(glm::vec2 pos, std::shared_ptr<UINode> self);
|
||||
|
||||
virtual bool isInteractive() const;
|
||||
virtual void setInteractive(bool flag);
|
||||
|
||||
virtual glm::vec2 contentOffset() {return glm::vec2(0.0f);};
|
||||
glm::vec2 calcCoord() const;
|
||||
void setCoord(glm::vec2 coord);
|
||||
virtual void setCoord(glm::vec2 coord);
|
||||
glm::vec2 size() const;
|
||||
virtual void size(glm::vec2 size);
|
||||
void _size(glm::vec2 size);
|
||||
|
||||
@@ -18,6 +18,9 @@ Container::Container(vec2 coord, vec2 size) : UINode(coord, size) {
|
||||
}
|
||||
|
||||
shared_ptr<UINode> Container::getAt(vec2 pos, shared_ptr<UINode> self) {
|
||||
if (!interactive) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!isInside(pos)) return nullptr;
|
||||
for (auto node : nodes) {
|
||||
if (!node->visible())
|
||||
|
||||
Reference in New Issue
Block a user