Skip to content

[MACOS] Trackpad scrolling conflicts with scroll animations when smooth scrolling is enabled #500

@wriver0s

Description

@wriver0s

If you have smooth scrolling enabled (the "Disable scroll animations" option unchecked) and try to scroll through an image using a Mac trackpad, the image fights back. It feels like it wants to snap back to where it was instead of following the gesture.

Disabling smooth scrolling fixes it, but that's not ideal.

The trackpad handler (wheelEventTrackpad) applies scroll deltas directly to the scrollbar, but it doesn't check if there's already a scroll animation running. So you end up with the animation trying to move the scrollbar one way while your trackpad input tries to move it another way. They fight each other.

Maybe just stop any running animations before applying the trackpad input?

 void Viewer::wheelEventTrackpad(QWheelEvent *event)                                                                                        
   {
      auto delta = event->pixelDelta();

      // Stop any running scroll animations to prevent conflict with trackpad input
      if (verticalScroller->state() == QAbstractAnimation::Running) {
          verticalScroller->stop();
      }
      if (horizontalScroller->state() == QAbstractAnimation::Running) {
          horizontalScroller->stop();
      }

      // ... rest unchanged

YACReader/viewer.cpp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions