added 'tooltip-delay' property

This commit is contained in:
MihailRis
2024-05-24 13:18:20 +03:00
parent 4400efae33
commit e3989cb178
7 changed files with 28 additions and 3 deletions
+2 -2
View File
@@ -62,8 +62,8 @@ void GUI::onAssetsLoad(Assets* assets) {
void GUI::updateTooltip(float delta) {
float mouseDelta = glm::length(Events::delta);
if ((hover && mouseDelta < 1.0f) ||
(hover && hover->isInside(Events::cursor) && tooltipTimer >= tooltipDelay)) {
if (tooltipTimer + delta >= tooltipDelay) {
(hover && hover->isInside(Events::cursor) && tooltipTimer >= hover->getTooltipDelay())) {
if (tooltipTimer + delta >= hover->getTooltipDelay()) {
auto label = std::dynamic_pointer_cast<gui::Label>(get("tooltip.label"));
const auto& text = hover->getTooltip();
if (label && !text.empty()) {