Skip to content

Commit

Permalink
Increase scroll speed for glium backend
Browse files Browse the repository at this point in the history
Each so called "line" of MuseScrollDelta::LineDelta de-facto represents
single scroller click which in most cases is 15 degrees of wheel
rotation.

Currently, one scroller click scrolls exactly one line of the text,
which is very slow.

This change multiplies the scroll rate by 5. So, with one click of the
scroller, 5 lines scrolled. This number is taken from the "iced" GUI
library and feels quite balanced.

Fixes emilk#461
  • Loading branch information
akhilman committed Sep 7, 2021
1 parent f9afdfa commit c871f00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion egui_glium/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ pub fn input_to_egui(
let mut delta = match *delta {
glutin::event::MouseScrollDelta::LineDelta(x, y) => {
let line_height = 8.0; // magic value!
vec2(x, y) * line_height
let number_of_lines = 5.0; // number of lines per one scroller click
vec2(x, y) * line_height * number_of_lines
}
glutin::event::MouseScrollDelta::PixelDelta(delta) => {
vec2(delta.x as f32, delta.y as f32) / pixels_per_point
Expand Down

0 comments on commit c871f00

Please sign in to comment.