Re-issue ui hint if hint string changed
This commit is contained in:
parent
b6ddd70989
commit
02dbdccf0d
1 changed files with 4 additions and 4 deletions
|
|
@ -61,7 +61,7 @@ namespace psemek::ui
|
||||||
float hint_timer = 0.f;
|
float hint_timer = 0.f;
|
||||||
util::function<void(element *)> on_hint;
|
util::function<void(element *)> on_hint;
|
||||||
element * hinted_element = nullptr;
|
element * hinted_element = nullptr;
|
||||||
bool hint_called = false;
|
std::optional<std::string> hint_called = std::nullopt;
|
||||||
|
|
||||||
impl(async::event_loop * loop);
|
impl(async::event_loop * loop);
|
||||||
|
|
||||||
|
|
@ -201,7 +201,7 @@ namespace psemek::ui
|
||||||
if (impl().hint_called && impl().on_hint)
|
if (impl().hint_called && impl().on_hint)
|
||||||
impl().on_hint(nullptr);
|
impl().on_hint(nullptr);
|
||||||
impl().hint_timer = 0.f;
|
impl().hint_timer = 0.f;
|
||||||
impl().hint_called = false;
|
impl().hint_called = std::nullopt;
|
||||||
}
|
}
|
||||||
impl().hinted_element = new_hinted_element;
|
impl().hinted_element = new_hinted_element;
|
||||||
|
|
||||||
|
|
@ -227,14 +227,14 @@ namespace psemek::ui
|
||||||
{
|
{
|
||||||
impl().update(dt);
|
impl().update(dt);
|
||||||
|
|
||||||
if (impl().hinted_element && !impl().hint_called)
|
if (impl().hinted_element && (!impl().hint_called || *impl().hint_called != *impl().hinted_element->hint()))
|
||||||
{
|
{
|
||||||
impl().hint_timer += dt;
|
impl().hint_timer += dt;
|
||||||
if (impl().hint_timer >= impl().hint_delay)
|
if (impl().hint_timer >= impl().hint_delay)
|
||||||
{
|
{
|
||||||
if (impl().on_hint)
|
if (impl().on_hint)
|
||||||
impl().on_hint(impl().hinted_element);
|
impl().on_hint(impl().hinted_element);
|
||||||
impl().hint_called = true;
|
impl().hint_called = *impl().hinted_element->hint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue