FreeTube icon indicating copy to clipboard operation
FreeTube copied to clipboard

Fix scroll to seek/change volume/playback rate changing too fast with touchpad

Open PikachuEXE opened this issue 10 months ago • 25 comments

Pull Request Type

  • [x] Bugfix
  • [ ] Feature Implementation
  • [ ] Documentation
  • [ ] Other

Related issue

Closes https://github.com/FreeTubeApp/FreeTube/issues/6539

Description

wheel triggered N times more than mouse wheel with smaller delta values to have smooth scrolling This PR throttles event handler on value change side only (prevent default/stop propagation still called all the time

Screenshots

With 100ms wait time, trackpad

https://github.com/user-attachments/assets/c017cf9a-31bb-4479-aa84-ce8404b595fc

Testing

A) Those without trackpad See https://github.com/FreeTubeApp/FreeTube/issues/6539, test with mouse wheel ensure it works similar to/same as before

B) Those with trackpad https://github.com/FreeTubeApp/FreeTube/issues/6539

Desktop

  • OS:
  • OS Version:
  • FreeTube version:

Additional context

I tested 50ms wait and it seems too fast (Too lazy to record that too

PikachuEXE avatar Jan 29 '25 02:01 PikachuEXE

Custom build: https://github.com/PikachuEXE/FreeTube/actions/runs/13023462048

PikachuEXE avatar Jan 29 '25 02:01 PikachuEXE

it seems slow but that could be because im testing on a trackpad

Feel free to change the 100ms values to something else to see how it feels To me 50ms seems too fast (on macOS trackpad No idea how other OSes handle trackpad scrolling

PikachuEXE avatar Jan 31 '25 02:01 PikachuEXE

I let the others chime into this one as i find it difficult to evaluate what a good speed for this is

I rarely use trackpad not to mention scrolling So same as you

PikachuEXE avatar Feb 01 '25 02:02 PikachuEXE

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Feb 18 '25 01:02 github-actions[bot]

Pull Request Type

  • [x] Bugfix
  • [ ] Feature Implementation
  • [ ] Documentation
  • [ ] Other

Related issue

Closes https://github.com/FreeTubeApp/FreeTube/issues/6539

Description

wheel triggered N times more than mouse wheel with smaller delta values to have smooth scrolling This PR throttles event handler on value change side only (prevent default/stop propagation still called all the time

Screenshots

With 100ms wait time, trackpad

https://github.com/user-attachments/assets/c017cf9a-31bb-4479-aa84-ce8404b595fc

Testing

A) Those without trackpad See https://github.com/FreeTubeApp/FreeTube/issues/6539, test with mouse wheel ensure it works similar to/same as before

B) Those with trackpad https://github.com/FreeTubeApp/FreeTube/issues/6539

Desktop

  • OS:
  • OS Version:
  • FreeTube version:

Additional context

I tested 50ms wait and it seems too fast (Too lazy to record that too

NgigaN avatar Feb 28 '25 04:02 NgigaN

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Mar 15 '25 01:03 github-actions[bot]

@absidue @ChunkyProgrammer @kommunarr your input is needed

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Apr 01 '25 02:04 github-actions[bot]

@absidue @ChunkyProgrammer @kommunarr your input is needed

I don't have a laptop so I can't really test this/suggest a good speed

ChunkyProgrammer avatar Apr 08 '25 02:04 ChunkyProgrammer

This pull request has conflicts, please resolve those before we can evaluate the pull request.

github-actions[bot] avatar Apr 12 '25 03:04 github-actions[bot]

scrolling rate/speed is perfect with the new build,

but, there is a a bit of rubber-banding feeling with the scrolling (like I could scroll the volume from 50% to 100%, but it will settle on 95%), and also it doesn't always scroll smoothly, but that's not a major issue.

also there is still the lack of ability to reverse the scrolling direction for the following 3 settings in the FreeTube app settings > Player section:

  • Scroll Volume Over Video Player
  • Scroll Playback Rate Over Video Player
  • Skip by Scrolling Over Video Player

checktext00 avatar Apr 16 '25 13:04 checktext00

@PikachuEXE can you rebase into dev. Im having playback issues

Conflicts have been resolved. A maintainer will review the pull request shortly.

github-actions[bot] avatar Apr 17 '25 00:04 github-actions[bot]

New custom build: https://github.com/PikachuEXE/FreeTube/actions/runs/14505024327

PikachuEXE avatar Apr 17 '25 00:04 PikachuEXE

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar May 02 '25 02:05 github-actions[bot]

@PikachuEXE can you rebase into dev. Im having playback issues

Probably best to rebase again and provide a new build

Rebased and build started: https://github.com/PikachuEXE/FreeTube/actions/runs/14853765114

PikachuEXE avatar May 06 '25 07:05 PikachuEXE

I do have mixed feelings about this PR. It makes the UX with a scroll wheel objectively worse but makes trackpad more manageable.

I've tested this with trackpad again on nightly and with this change. The before doesnt seem that bad. It requires some getting used to because the swiping gestures have to be made slower in order to decrease/increase the volume by a bit.

I think i would choose having a bad trackpad over a bad scrollwheel + the fact that only one user reported this makes me think that this isnt that big of a deal

Not blaming the implementation here but this seems to be a case of pick the lesser evil one. if no acceptable middle ground can be found then we should close this

The way our mouse volume/skip scrolling currently works is by using hardcoded jumps for each event, so one event equals:

  • 5% volume
  • default skip interval * playback rate
  • 0.05x playback rate

On trackpads scrolling on a page is generally smoother whereas with a mouse it tends to jump a bit. Unconfirmed theory: Trackpads send events more frequently but each event is for a smaller "scroll distance", mice send less frequently but each event has a larger "scroll distance".

This pull request currently addresses the too large jumps on touch pads by ignoring various events. If my theory above is correct we may instead be able to base the increases/decreases on the distance that was scrolled (deltaX, deltaY and deltaMode) instead of hardcoded values (we would likely have to normalise the values a bit instead of using the raw "scroll distance"), that way it would hopefully even out/make it more similar for mice and trackpads.

absidue avatar May 06 '25 15:05 absidue

The values in event.deltaY are +/-120 via wheels and +/-1 in trackpad Problem is that the no. of events is too big to normalize the value changed (e.g. can't change volume by 0.1%... 1% per event = still too fast

Let me see if I can make it only use throttle when delta is small enough (and verify if what I mentioned above is correct, forgot

PikachuEXE avatar May 06 '25 21:05 PikachuEXE

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar May 22 '25 02:05 github-actions[bot]

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Jun 06 '25 02:06 github-actions[bot]

Update: Only apply scroll throttle when delta value is small (assumed to be from touchpad), update throttle wait 100 > 200ms

PikachuEXE avatar Jun 17 '25 00:06 PikachuEXE

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Jul 01 '25 02:07 github-actions[bot]

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Jul 24 '25 02:07 github-actions[bot]