diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-05-26 08:49:14 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-05-26 08:49:14 +0200 |
commit | f7e5e4d6671e4c3bd1a0a65cb45ea6c2531d448d (patch) | |
tree | cded67f77193c2046a9ee968de2eb0cd740c92b7 /src | |
parent | c3bc6fbd7f4fffff90b40f813418b0dbd030bbd2 (diff) |
bla
Diffstat (limited to 'src')
-rw-r--r-- | src/Body.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Body.cpp b/src/Body.cpp index 504f0ee..efc47f8 100644 --- a/src/Body.cpp +++ b/src/Body.cpp @@ -523,18 +523,20 @@ namespace QuickMedia { if(is_touch_enabled()) { const sf::Vector2f mouse_pos_diff(mouse_pos_raw.x - mouse_pos.x, mouse_pos_raw.y - mouse_pos.y); - const float move_speed = 25.0f; + const float move_speed = 35.0f; + sf::Vector2f prev_mouse_pos = mouse_pos; mouse_pos.x += (mouse_pos_diff.x * std::min(1.0f, frame_time * move_speed)); mouse_pos.y += (mouse_pos_diff.y * std::min(1.0f, frame_time * move_speed)); + const sf::Vector2f mouse_pos_diff_smooth = mouse_pos - prev_mouse_pos; sf::Vector2f mouse_pos_raw_diff(mouse_pos_raw.x - prev_mouse_pos_raw.x, mouse_pos_raw.y - prev_mouse_pos_raw.y); prev_mouse_pos_raw = mouse_pos_raw; if(items_cut_off) { if(mouse_left_pressed) { - page_scroll += mouse_pos_raw_diff.y; + page_scroll += mouse_pos_diff_smooth.y; mouse_scroll_accel = sf::Vector2f(mouse_pos_raw_diff.x, mouse_pos_raw_diff.y); - mouse_scroll_accel *= (float)((double)frame_time * 288.0); + mouse_scroll_accel *= (float)((double)frame_time * 180.0); } else { page_scroll += mouse_scroll_accel.y; } |