Add mouse-timeout plugin

This commit adds a generic mouse-timeout plugin. (Same code was
originally part of toolbar plugin, but is now general purpose and
available to user to apply any CSS to it.)

Although this implementation is different and more generic, the
suggestion to add ability to hide mouse cursor came from
a pull request by Sebastian Clausen (@sclausen):
impress#536

The functionality is simple:

After 3 seconds of mouse inactivity, add the css class
`body.impress-mouse-timeout`. On `mousemove`, `click` or `touch`, remove the
class.

A user will then use (or not) his own CSS to hide whatever he wants to hide
after 3 seconds of mouse inactivity.
This commit is contained in:
Henrik Ingo
2017-10-23 23:27:18 +03:00
parent 3697c5b540
commit 713557d4d2
2 changed files with 92 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
Mouse timeout plugin
====================
After 3 seconds of mouse inactivity, add the css class
`body.impress-mouse-timeout`. On `mousemove`, `click` or `touch`, remove the
class.
The use case for this plugin is to use CSS to hide elements from the screen
and only make them visible when the mouse is moved. Examples where this
might be used are: the toolbar from the toolbar plugin, and the mouse cursor
itself.
Example CSS
------------
body.impress-mouse-timeout {
cursor: none;
}
body.impress-mouse-timeout div#impress-toolbar {
display: none;
}
Copyright 2016 Henrik Ingo (@henrikingo)
Released under the MIT license.