summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-01-10 19:19:36 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-01-10 19:19:36 +0200
commit5472891b5711138d3c54bd90508720a935c36de7 (patch)
treecab98c477b79b864e9c39ad14d37f4890b902793
parent743dbe9f3ff5bd6daee28320ac80ace73e13f08d (diff)
Cleanup
-rw-r--r--src/ui/documentwidget.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 8603f1fe..78624c7a 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -2220,15 +2220,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
2220 } 2220 }
2221 } 2221 }
2222 else if (ev->type == SDL_MOUSEWHEEL && isHover_Widget(w)) { 2222 else if (ev->type == SDL_MOUSEWHEEL && isHover_Widget(w)) {
2223 float acceleration = 1.0f;
2224 const iInt2 mouseCoord = mouseCoord_Window(get_Window()); 2223 const iInt2 mouseCoord = mouseCoord_Window(get_Window());
2225 if (prefs_App()->hoverOutline &&
2226 contains_Widget(constAs_Widget(d->scroll), mouseCoord)) {
2227 const int outHeight = outlineHeight_DocumentWidget_(d);
2228 if (outHeight > height_Rect(bounds_Widget(w))) {
2229 acceleration = (float) size_GmDocument(d->doc).y / (float) outHeight;
2230 }
2231 }
2232#if defined (iPlatformApple) 2224#if defined (iPlatformApple)
2233 /* On macOS, we handle both trackpad and mouse events. We expect SDL to identify 2225 /* On macOS, we handle both trackpad and mouse events. We expect SDL to identify
2234 which device is sending the event. */ 2226 which device is sending the event. */
@@ -2242,7 +2234,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
2242 else { 2234 else {
2243 wheel.x = 0; 2235 wheel.x = 0;
2244 } 2236 }
2245 scroll_DocumentWidget_(d, -wheel.y * get_Window()->pixelRatio * acceleration); 2237 scroll_DocumentWidget_(d, -wheel.y * get_Window()->pixelRatio);
2246 scrollWideBlock_DocumentWidget_(d, mouseCoord, wheel.x * get_Window()->pixelRatio, 0); 2238 scrollWideBlock_DocumentWidget_(d, mouseCoord, wheel.x * get_Window()->pixelRatio, 0);
2247 } 2239 }
2248 else 2240 else
@@ -2260,7 +2252,7 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e
2260 } 2252 }
2261 smoothScroll_DocumentWidget_( 2253 smoothScroll_DocumentWidget_(
2262 d, 2254 d,
2263 -3 * amount * lineHeight_Text(paragraph_FontId) * acceleration, 2255 -3 * amount * lineHeight_Text(paragraph_FontId),
2264 smoothDuration_DocumentWidget_ * 2256 smoothDuration_DocumentWidget_ *
2265 /* accelerated speed for repeated wheelings */ 2257 /* accelerated speed for repeated wheelings */
2266 (!isFinished_Anim(&d->scrollY) && pos_Anim(&d->scrollY) < 0.25f ? 0.5f : 1.0f)); 2258 (!isFinished_Anim(&d->scrollY) && pos_Anim(&d->scrollY) < 0.25f ? 0.5f : 1.0f));