Projects STRLCPY alacritty Commits 79ea8b94
🤬
  • Relax horizontal scrolling

    Apply horizontal scrolling when the angle between the axis X
    and (x, y) vector is lower than 25 degrees.
    
    Fixes #6711.
  • Loading...
  • Kirill Chibisov committed with GitHub 1 year ago
    79ea8b94
    1 parent c682a357
  • ■ ■ ■ ■ ■
    alacritty/src/input.rs
    skipped 647 lines
    648 648   let new_scroll_px_y = lines * self.ctx.size_info().cell_height();
    649 649   self.scroll_terminal(new_scroll_px_x as f64, new_scroll_px_y as f64);
    650 650   },
    651  - MouseScrollDelta::PixelDelta(lpos) => {
     651 + MouseScrollDelta::PixelDelta(mut lpos) => {
    652 652   match phase {
    653 653   TouchPhase::Started => {
    654 654   // Reset offset to zero.
    655 655   self.ctx.mouse_mut().accumulated_scroll = Default::default();
    656 656   },
    657 657   TouchPhase::Moved => {
     658 + // When the angle between (x, 0) and (x, y) is lower than ~25 degrees
     659 + // (cosine is larger that 0.9) we consider this scrolling as horizontal.
     660 + if lpos.x.abs() / lpos.x.hypot(lpos.y) > 0.9 {
     661 + lpos.y = 0.;
     662 + } else {
     663 + lpos.x = 0.;
     664 + }
     665 + 
    658 666   self.scroll_terminal(lpos.x, lpos.y);
    659 667   },
    660 668   _ => (),
    skipped 865 lines
Please wait...
Page is in error, reload to recover