diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-18 21:41:46 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-18 21:41:46 +0200 |
commit | 3d0f88fcf9a262680c19bd5c44e407a02c409dcf (patch) | |
tree | cfd39dbe14683e5c9fa4b24805a49c3301a10f3f /src/ui/documentwidget.c | |
parent | 0962147cc8fa92e5a79458bf1270ded51c9a4433 (diff) |
iOS: Working on touch event handling
Handle finger down, motion, and up events to implement basic taps, long presses, and inertia scrolling.
Much finetuning still to be done, and certain widgets like input fields and scrollbars need a direct drag mode (they were working fine via the "mouse" events already).
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 232b4140..0a282f1b 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -2351,7 +2351,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2351 | which device is sending the event. */ | 2351 | which device is sending the event. */ |
2352 | if (ev->wheel.which == 0) { /* Trackpad with precise scrolling w/inertia. */ | 2352 | if (ev->wheel.which == 0) { /* Trackpad with precise scrolling w/inertia. */ |
2353 | stop_Anim(&d->scrollY); | 2353 | stop_Anim(&d->scrollY); |
2354 | iInt2 wheel = init_I2(ev->wheel.x, ev->wheel.y); | 2354 | iInt2 wheel = mulf_I2(init_I2(ev->wheel.x, ev->wheel.y), get_Window()->pixelRatio); |
2355 | /* Only scroll on one axis at a time. */ | 2355 | /* Only scroll on one axis at a time. */ |
2356 | if (iAbs(wheel.x) > iAbs(wheel.y)) { | 2356 | if (iAbs(wheel.x) > iAbs(wheel.y)) { |
2357 | wheel.y = 0; | 2357 | wheel.y = 0; |
@@ -2359,8 +2359,11 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
2359 | else { | 2359 | else { |
2360 | wheel.x = 0; | 2360 | wheel.x = 0; |
2361 | } | 2361 | } |
2362 | scroll_DocumentWidget_(d, -wheel.y * get_Window()->pixelRatio); | 2362 | scroll_DocumentWidget_(d, -wheel.y); |
2363 | scrollWideBlock_DocumentWidget_(d, mouseCoord, wheel.x * get_Window()->pixelRatio, 0); | 2363 | #if defined (iPlatformAppleMobile) |
2364 | wheel.x = -wheel.x; | ||
2365 | #endif | ||
2366 | scrollWideBlock_DocumentWidget_(d, mouseCoord, wheel.x, 0); | ||
2364 | } | 2367 | } |
2365 | else | 2368 | else |
2366 | #endif | 2369 | #endif |