diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-09 10:57:09 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-04-09 10:57:09 +0300 |
commit | 406bda52ea612c199a0e16f5b21483cac4aded98 (patch) | |
tree | f908a01a189fb167f9e0424f77eb1abb828b993e /src | |
parent | f98a402641384d9f574e020617eeaf89957f2a41 (diff) |
DocumentWidget: Slightly longer alt text hover delay
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/documentwidget.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 3c16df74..73bd8aaa 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -591,6 +591,7 @@ static void updateHover_DocumentWidget_(iDocumentWidget *d, iInt2 mouse) { | |||
591 | } | 591 | } |
592 | refresh_Widget(w); | 592 | refresh_Widget(w); |
593 | } | 593 | } |
594 | /* Hovering over preformatted blocks. */ | ||
594 | if (isHover_Widget(w)) { | 595 | if (isHover_Widget(w)) { |
595 | iConstForEach(PtrArray, j, &d->visiblePre) { | 596 | iConstForEach(PtrArray, j, &d->visiblePre) { |
596 | const iGmRun *run = j.ptr; | 597 | const iGmRun *run = j.ptr; |
@@ -602,7 +603,7 @@ static void updateHover_DocumentWidget_(iDocumentWidget *d, iInt2 mouse) { | |||
602 | } | 603 | } |
603 | } | 604 | } |
604 | if (!d->hoverPre) { | 605 | if (!d->hoverPre) { |
605 | setValueSpeed_Anim(&d->altTextOpacity, 0.0f, 2); | 606 | setValueSpeed_Anim(&d->altTextOpacity, 0.0f, 1.5f); |
606 | if (!isFinished_Anim(&d->altTextOpacity)) { | 607 | if (!isFinished_Anim(&d->altTextOpacity)) { |
607 | animate_DocumentWidget_(d); | 608 | animate_DocumentWidget_(d); |
608 | } | 609 | } |
@@ -610,7 +611,7 @@ static void updateHover_DocumentWidget_(iDocumentWidget *d, iInt2 mouse) { | |||
610 | else if (d->hoverPre && | 611 | else if (d->hoverPre && |
611 | preHasAltText_GmDocument(d->doc, d->hoverPre->preId) && | 612 | preHasAltText_GmDocument(d->doc, d->hoverPre->preId) && |
612 | ~d->flags & noHoverWhileScrolling_DocumentWidgetFlag) { | 613 | ~d->flags & noHoverWhileScrolling_DocumentWidgetFlag) { |
613 | setValueSpeed_Anim(&d->altTextOpacity, 1.0f, 2); | 614 | setValueSpeed_Anim(&d->altTextOpacity, 1.0f, 1.5f); |
614 | if (!isFinished_Anim(&d->altTextOpacity)) { | 615 | if (!isFinished_Anim(&d->altTextOpacity)) { |
615 | animate_DocumentWidget_(d); | 616 | animate_DocumentWidget_(d); |
616 | } | 617 | } |
@@ -2563,7 +2564,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2563 | setCursor_Window(get_Window(), SDL_SYSTEM_CURSOR_HAND); | 2564 | setCursor_Window(get_Window(), SDL_SYSTEM_CURSOR_HAND); |
2564 | } | 2565 | } |
2565 | else { | 2566 | else { |
2566 | if (value_Anim(&d->altTextOpacity) < 0.667f) { | 2567 | if (value_Anim(&d->altTextOpacity) < 0.833f) { |
2567 | setValue_Anim(&d->altTextOpacity, 0, 0); /* keep it hidden while moving */ | 2568 | setValue_Anim(&d->altTextOpacity, 0, 0); /* keep it hidden while moving */ |
2568 | } | 2569 | } |
2569 | updateHover_DocumentWidget_(d, mpos); | 2570 | updateHover_DocumentWidget_(d, mpos); |
@@ -3558,7 +3559,7 @@ static void draw_DocumentWidget_(const iDocumentWidget *d) { | |||
3558 | } | 3559 | } |
3559 | draw_Widget(w); | 3560 | draw_Widget(w); |
3560 | /* Alt text. */ | 3561 | /* Alt text. */ |
3561 | const float altTextOpacity = value_Anim(&d->altTextOpacity) * 3 - 2; | 3562 | const float altTextOpacity = value_Anim(&d->altTextOpacity) * 6 - 5; |
3562 | if (d->hoverAltPre && altTextOpacity > 0) { | 3563 | if (d->hoverAltPre && altTextOpacity > 0) { |
3563 | const iGmPreMeta *meta = preMeta_GmDocument(d->doc, d->hoverAltPre->preId); | 3564 | const iGmPreMeta *meta = preMeta_GmDocument(d->doc, d->hoverAltPre->preId); |
3564 | if (meta->flags & topLeft_GmPreMetaFlag && ~meta->flags & decoration_GmRunFlag && | 3565 | if (meta->flags & topLeft_GmPreMetaFlag && ~meta->flags & decoration_GmRunFlag && |