Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deactivate action of (mouse) scroll wheel (go to next slide)? #340

Closed
sbibauw opened this issue Apr 25, 2021 · 4 comments · Fixed by #345
Closed

How to deactivate action of (mouse) scroll wheel (go to next slide)? #340

sbibauw opened this issue Apr 25, 2021 · 4 comments · Fixed by #345

Comments

@sbibauw
Copy link

sbibauw commented Apr 25, 2021

I love Marp, but when I'm presenting, using an Apple Mouse, the scroll wheel gets very often moved without my intent and then it makes the slideshow move to the next/previous slide(s)/event(s) very fast.

  1. Is it possible to deactivate this action of the mouse scroll wheel?
  2. I think it would be better deactivated by default (most of us expect using either the Space bar or the [→] key to go to the next slide, not the scroll wheel).
@yhatt yhatt transferred this issue from marp-team/marp-core Apr 25, 2021
@yhatt
Copy link
Member

yhatt commented Apr 25, 2021

Transferred from Marp Core ▶️ Marp CLI 🚚. Wheel navigation is a part of Marp CLI's template bespoke.

  1. No. Always works for now.
  2. It's discussable in this issue or our community. But I don't think so. IMO I don't really want to disable it by default:
    • Wheel navigation is familiar control in many presentation tools such as PowerPoint and Google Slide.
    • For the most of visitors to public HTML presentation, wheel control feels like a primary control for web.
    • I believe it can resolve by adjusting sensitivity of wheel event. (following)

I don't have Magic Mouse so can't test actual behavior, but all of swipe gestures should fire events as by mouse wheel because JavaScript cannot detect what kind of device for navigation.

Marp CLI's bespoke template has already included a special handling for mouse wheel event(s): A basic handling to prevent continuous events by momentum scroll (triggered by Magic Trackpad and also maybe Magic Mouse).

// Suppress momentum scrolling by trackpad
if (wheelIntervalTimer) clearTimeout(wheelIntervalTimer)
wheelIntervalTimer = setTimeout(() => {
lastWheelDelta = 0
}, interval)
const debouncing = Date.now() - lastWheelNavigationAt < interval
const currentWheelDelta = Math.sqrt(e.deltaX ** 2 + e.deltaY ** 2)
const attenuated = currentWheelDelta <= lastWheelDelta
lastWheelDelta = currentWheelDelta

But not yet handled ​high sensitivity against the fine movement of the finger on Magic Mouse.

I think we can get both of responsive and not too sensitive navigation by tuning wheel events in some approaches: Setting delta threshold for starting navigation, and throttling continously brought wheel events.

We want to hear more feedbacks from Magic Mouse user.

@sbibauw
Copy link
Author

sbibauw commented Apr 26, 2021

Thanks @yhatt. OK, maybe indeed a reduction in sensitivity adapted to the Magic Mouse could be an option. Right now, I really have a problem that my slides often go 3-4 steps backward without any intent.

If not, then the possibility (if easy to implement) to deactivate this in the configuration of Marp-CLI/Marp-vscode would work for me as well.

@yhatt
Copy link
Member

yhatt commented Apr 27, 2021

Personally I have interested how other Web-based presentation tools such as Google Slides are resolving Magic Mouse problem. If navigation worked comfortable in them, Marp should be better to apply improvement in similar way too.

In the meantime, you can use this workaround:

  1. Open DevTools in your browser (Hit F12 in the case of most browsers)
  2. Input following to console, and Enter.

    document.addEventListener('mousewheel', e => e.stopPropagation(), true)

Now any wheel events have prevented.

@yhatt yhatt added the help wanted Extra attention is needed label May 7, 2021
@yhatt yhatt removed the help wanted Extra attention is needed label May 11, 2021
@yhatt
Copy link
Member

yhatt commented May 11, 2021

Marp CLI v1.1.0 has released with tuned wheel sensitivity against Multi-touch devices like the trackpad and Magic Mouse. I hope it is reduced too sensitive navigations with Apple Mouse.

Even if not satisfied with the updated behavior, the workaround in above will work continously.

By this change, the navigation experience by the other device may be degraded. We are welcome to various feedbacks continuously from users using a particular device!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants