summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-07-27 15:29:43 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-07-27 15:29:43 +0300
commite19a2207ead91d8be4ff089571498285e3f6dbd3 (patch)
treeb12150ff2d8d6c3b4dd23b45e0ce7bd8a840e9c8 /src/ui/documentwidget.c
parent3098d0e5b98ba11826ed1bdd44ed545db6b84b63 (diff)
DocumentWidget: Fine-tuning
Stop hovering on links when fetching content, and clamp scroll position when resizing the view.
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 079f08f4..36ec99ff 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -399,6 +399,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
399 iWidget *w = as_Widget(d); 399 iWidget *w = as_Widget(d);
400 if (isResize_UserEvent(ev)) { 400 if (isResize_UserEvent(ev)) {
401 setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d)); 401 setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d));
402 scroll_DocumentWidget_(d, 0);
402 updateVisible_DocumentWidget_(d); 403 updateVisible_DocumentWidget_(d);
403 refresh_Widget(w); 404 refresh_Widget(w);
404 } 405 }
@@ -564,11 +565,13 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
564 const iGmRun *oldHoverLink = d->hoverLink; 565 const iGmRun *oldHoverLink = d->hoverLink;
565 d->hoverLink = NULL; 566 d->hoverLink = NULL;
566 const iInt2 hoverPos = addY_I2(sub_I2(mouse, topLeft_Rect(docBounds)), d->scrollY); 567 const iInt2 hoverPos = addY_I2(sub_I2(mouse, topLeft_Rect(docBounds)), d->scrollY);
567 iConstForEach(PtrArray, i, &d->visibleLinks) { 568 if (d->state == ready_DocumentState) {
568 const iGmRun *run = i.ptr; 569 iConstForEach(PtrArray, i, &d->visibleLinks) {
569 if (contains_Rect(run->bounds, hoverPos)) { 570 const iGmRun *run = i.ptr;
570 d->hoverLink = run; 571 if (contains_Rect(run->bounds, hoverPos)) {
571 break; 572 d->hoverLink = run;
573 break;
574 }
572 } 575 }
573 } 576 }
574 if (d->hoverLink != oldHoverLink) { 577 if (d->hoverLink != oldHoverLink) {