Hoverable class no longer drives tooltips. Rather, a tooltip widget can be parented to any widget.

This commit is contained in:
2025-02-04 19:43:36 -05:00
parent 135a1564f2
commit 83ffecb91d
2 changed files with 7 additions and 7 deletions

View File

@@ -31,11 +31,11 @@ namespace JUI
virtual void OnExit(const Vector2& MousePos);
void Update(const Vector2& m_pos, float delta);
virtual void SetTooltip(const std::string& content, float delay) {}
//virtual void SetTooltip(const std::string& content, float delay) {}
protected:
Tooltip* tooltip = nullptr;
float tooltip_threshold = 0.f;
float tooltip_limit = 0.125f;
//Tooltip* tooltip = nullptr;
//float tooltip_threshold = 0.f;
//float tooltip_limit = 0.125f;
bool hovered = false;
bool hover_debounce = false;
};

View File

@@ -7,12 +7,12 @@ void JUI::Hoverable::OnHover(const Vector2 &MousePos) {
void JUI::Hoverable::OnExit(const Vector2 &MousePos) {
OnExitEvent.Invoke(MousePos);
tooltip_threshold = 0;
//tooltip_threshold = 0;
}
void JUI::Hoverable::Update(const Vector2 &m_pos, float delta) {
if (tooltip != nullptr)
/*if (tooltip != nullptr)
{
if (IsHovered()) {
tooltip->Visible(true);
@@ -20,7 +20,7 @@ void JUI::Hoverable::Update(const Vector2 &m_pos, float delta) {
} else {
tooltip->Visible(false);
}
}
}*/
if (IsHovered() && !hover_debounce) {