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

Add hide mouse class to the container if inactive #153

Merged
merged 4 commits into from
Oct 16, 2021

Conversation

nanot1m
Copy link
Contributor

@nanot1m nanot1m commented Oct 15, 2021

Current PR add mouse module to shower.

Only for full mode:

If mouse is not moved for timeout (default 5000ms) then mouse-hidden (configurable in options) class is added to the shower container.
And on every mouse move timer is reset and this class is being removed.

Fixes shower/shower#377

@pepelsbey
Copy link
Contributor

Thank you so much!

I decided to fool around a bit and called the class name pointless :)

I’ll check a few things first and then merge it.

@pepelsbey
Copy link
Contributor

So I made it work by replacing on with addEventListener.

But there’s a quirk:

  1. Open slides in list mode: nothing happens so far
  2. Enter full screen mode, stop moving cursor: you’ll get the poinless class name.
  3. Exit full screen mode (Esc): the poinless class name will go away
  4. Do nothing for 5s and you’ll get the poinless class name (in list mode)

Meaning that the timer should stop counting once I get back from full screen mode back to list mode.

It should be similar to the next.js module, something like if (shower.isListMode) return;

@pepelsbey pepelsbey merged commit 21199ec into shower:main Oct 16, 2021
@pepelsbey
Copy link
Contributor

Thank you! I’ll release it shortly :)

It would be also great to write some tests for this module. So if you’ll have some time it would be awesome.

@nanot1m nanot1m deleted the hide-mouse-if-inactive branch October 16, 2021 13:44
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 this pull request may close these issues.

Hide cursor after 5 seconds of non-movement for a presentation mode
2 participants