fix: tooltip visibility when cursor is hidden
This commit is contained in:
parent
e3989cb178
commit
cc27e4b224
@ -87,8 +87,6 @@ void GUI::updateTooltip(float delta) {
|
||||
|
||||
/// @brief Mouse related input and logic handling
|
||||
void GUI::actMouse(float delta) {
|
||||
updateTooltip(delta);
|
||||
|
||||
float mouseDelta = glm::length(Events::delta);
|
||||
doubleClicked = false;
|
||||
doubleClickTimer += delta + mouseDelta * 0.1f;
|
||||
@ -177,8 +175,14 @@ void GUI::act(float delta, const Viewport& vp) {
|
||||
container->act(delta);
|
||||
auto prevfocus = focus;
|
||||
|
||||
updateTooltip(delta);
|
||||
if (!Events::_cursor_locked) {
|
||||
actMouse(delta);
|
||||
} else {
|
||||
if (hover) {
|
||||
hover->setHover(false);
|
||||
hover = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (focus) {
|
||||
|
||||
@ -13,7 +13,7 @@ Container::Container(glm::vec2 size) : UINode(size) {
|
||||
}
|
||||
|
||||
std::shared_ptr<UINode> Container::getAt(glm::vec2 pos, std::shared_ptr<UINode> self) {
|
||||
if (!interactive || !isEnabled()) {
|
||||
if (!isInteractive() || !isEnabled()) {
|
||||
return nullptr;
|
||||
}
|
||||
if (!isInside(pos)) return nullptr;
|
||||
|
||||
@ -13,6 +13,9 @@ UINode::~UINode() {
|
||||
}
|
||||
|
||||
bool UINode::isVisible() const {
|
||||
if (visible && parent) {
|
||||
return parent->isVisible();
|
||||
}
|
||||
return visible;
|
||||
}
|
||||
|
||||
@ -107,7 +110,7 @@ bool UINode::isInside(glm::vec2 point) {
|
||||
}
|
||||
|
||||
std::shared_ptr<UINode> UINode::getAt(glm::vec2 point, std::shared_ptr<UINode> self) {
|
||||
if (!interactive || !enabled) {
|
||||
if (!isInteractive() || !enabled) {
|
||||
return nullptr;
|
||||
}
|
||||
return isInside(point) ? self : nullptr;
|
||||
@ -145,7 +148,6 @@ float UINode::getTooltipDelay() const {
|
||||
return tooltipDelay;
|
||||
}
|
||||
|
||||
|
||||
glm::vec2 UINode::calcPos() const {
|
||||
if (parent) {
|
||||
return pos + parent->calcPos() + parent->contentOffset();
|
||||
@ -332,6 +334,16 @@ void UINode::setGravity(Gravity gravity) {
|
||||
}
|
||||
}
|
||||
|
||||
bool UINode::isSubnodeOf(const UINode* node) {
|
||||
if (parent == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (parent == node) {
|
||||
return true;
|
||||
}
|
||||
return parent->isSubnodeOf(node);
|
||||
}
|
||||
|
||||
void UINode::getIndices(
|
||||
const std::shared_ptr<UINode> node,
|
||||
std::unordered_map<std::string, std::shared_ptr<UINode>>& map
|
||||
|
||||
@ -245,6 +245,8 @@ namespace gui {
|
||||
|
||||
virtual void setGravity(Gravity gravity);
|
||||
|
||||
bool isSubnodeOf(const UINode* node);
|
||||
|
||||
/// @brief collect all nodes having id
|
||||
static void getIndices(
|
||||
const std::shared_ptr<UINode> node,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user