diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/documentwidget.c | 8 | ||||
-rw-r--r-- | src/ui/listwidget.c | 8 | ||||
-rw-r--r-- | src/ui/touch.c | 10 | ||||
-rw-r--r-- | src/ui/touch.h | 1 |
4 files changed, 23 insertions, 4 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 53f44868..c3728b75 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -377,7 +377,7 @@ void deinit_DocumentWidget(iDocumentWidget *d) { | |||
377 | removeTicker_App(prerender_DocumentWidget_, d); | 377 | removeTicker_App(prerender_DocumentWidget_, d); |
378 | remove_Periodic(periodic_App(), d); | 378 | remove_Periodic(periodic_App(), d); |
379 | delete_Translation(d->translation); | 379 | delete_Translation(d->translation); |
380 | delete_DrawBufs(d->drawBufs); | 380 | delete_DrawBufs(d->drawBufs); |
381 | delete_VisBuf(d->visBuf); | 381 | delete_VisBuf(d->visBuf); |
382 | free(d->visBufMeta); | 382 | free(d->visBufMeta); |
383 | delete_PtrSet(d->invalidRuns); | 383 | delete_PtrSet(d->invalidRuns); |
@@ -1273,10 +1273,14 @@ static void smoothScroll_DocumentWidget_(iDocumentWidget *d, int offset, int dur | |||
1273 | int destY = targetValue_Anim(&d->scrollY) + offset; | 1273 | int destY = targetValue_Anim(&d->scrollY) + offset; |
1274 | if (destY < 0) { | 1274 | if (destY < 0) { |
1275 | destY = 0; | 1275 | destY = 0; |
1276 | stopWidgetMomentum_Touch(as_Widget(d)); | ||
1276 | } | 1277 | } |
1277 | const int scrollMax = scrollMax_DocumentWidget_(d); | 1278 | const int scrollMax = scrollMax_DocumentWidget_(d); |
1278 | if (scrollMax > 0) { | 1279 | if (scrollMax > 0) { |
1279 | destY = iMin(destY, scrollMax); | 1280 | if (destY >= scrollMax) { |
1281 | stopWidgetMomentum_Touch(as_Widget(d)); | ||
1282 | destY = scrollMax; | ||
1283 | } | ||
1280 | } | 1284 | } |
1281 | else { | 1285 | else { |
1282 | destY = 0; | 1286 | destY = 0; |
diff --git a/src/ui/listwidget.c b/src/ui/listwidget.c index f571bea5..8690f8e5 100644 --- a/src/ui/listwidget.c +++ b/src/ui/listwidget.c | |||
@@ -172,9 +172,13 @@ iBool scrollOffset_ListWidget(iListWidget *d, int offset) { | |||
172 | d->scrollY += offset; | 172 | d->scrollY += offset; |
173 | if (d->scrollY < 0) { | 173 | if (d->scrollY < 0) { |
174 | d->scrollY = 0; | 174 | d->scrollY = 0; |
175 | stopWidgetMomentum_Touch(as_Widget(d)); | ||
175 | } | 176 | } |
176 | const int scrollMax = scrollMax_ListWidget_(d); | 177 | const int scrollMax = scrollMax_ListWidget_(d); |
177 | d->scrollY = iMin(d->scrollY, scrollMax); | 178 | if (d->scrollY >= scrollMax) { |
179 | d->scrollY = scrollMax; | ||
180 | stopWidgetMomentum_Touch(as_Widget(d)); | ||
181 | } | ||
178 | d->noHoverWhileScrolling = iTrue; | 182 | d->noHoverWhileScrolling = iTrue; |
179 | if (oldScroll != d->scrollY) { | 183 | if (oldScroll != d->scrollY) { |
180 | if (d->hoverItem != iInvalidPos) { | 184 | if (d->hoverItem != iInvalidPos) { |
@@ -310,7 +314,7 @@ static iBool processEvent_ListWidget_(iListWidget *d, const SDL_Event *ev) { | |||
310 | return iTrue; | 314 | return iTrue; |
311 | } | 315 | } |
312 | } | 316 | } |
313 | else if (ev->type == SDL_USEREVENT && ev->user.code == widgetTapBegins_UserEventCode) { | 317 | else if (ev->type == SDL_USEREVENT && ev->user.code == widgetTapBegins_UserEventCode) { |
314 | d->noHoverWhileScrolling = iFalse; | 318 | d->noHoverWhileScrolling = iFalse; |
315 | } | 319 | } |
316 | if (ev->type == SDL_MOUSEMOTION) { | 320 | if (ev->type == SDL_MOUSEMOTION) { |
diff --git a/src/ui/touch.c b/src/ui/touch.c index 8a532821..834fe4f8 100644 --- a/src/ui/touch.c +++ b/src/ui/touch.c | |||
@@ -696,6 +696,16 @@ iBool processEvent_Touch(const SDL_Event *ev) { | |||
696 | return iTrue; | 696 | return iTrue; |
697 | } | 697 | } |
698 | 698 | ||
699 | void stopWidgetMomentum_Touch(iWidget *widget) { | ||
700 | iTouchState *d = touchState_(); | ||
701 | iForEach(Array, i, d->moms) { | ||
702 | iMomentum *mom = i.value; | ||
703 | if (mom->affinity == widget) { | ||
704 | remove_ArrayIterator(&i); | ||
705 | } | ||
706 | } | ||
707 | } | ||
708 | |||
699 | void widgetDestroyed_Touch(iWidget *widget) { | 709 | void widgetDestroyed_Touch(iWidget *widget) { |
700 | iTouchState *d = touchState_(); | 710 | iTouchState *d = touchState_(); |
701 | iForEach(Array, i, d->touches) { | 711 | iForEach(Array, i, d->touches) { |
diff --git a/src/ui/touch.h b/src/ui/touch.h index 3e9c3859..0a24248b 100644 --- a/src/ui/touch.h +++ b/src/ui/touch.h | |||
@@ -29,6 +29,7 @@ iDeclareType(Widget) | |||
29 | 29 | ||
30 | iBool processEvent_Touch (const SDL_Event *); | 30 | iBool processEvent_Touch (const SDL_Event *); |
31 | void update_Touch (void); | 31 | void update_Touch (void); |
32 | void stopWidgetMomentum_Touch(iWidget *widget); | ||
32 | void widgetDestroyed_Touch (iWidget *widget); | 33 | void widgetDestroyed_Touch (iWidget *widget); |
33 | 34 | ||
34 | iInt2 latestPosition_Touch (void); /* valid during processing of current event */ | 35 | iInt2 latestPosition_Touch (void); /* valid during processing of current event */ |