some cleanup and docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-03-04 17:55:33 +03:00
parent 60b981ee22
commit 7adea1d9fc

View File

@ -1061,6 +1061,11 @@ module.Clickable = core.ImageGridFeatures.Feature({
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// NOTE: removing the prop 'cursor-autohide' will stop hiding the cursor
// and show it on next timeout/mousemove.
// This will not stop watching the cursor, this setting the prop back
// on will re-enable autohide.
// XXX needs testing...
var AutoHideCursor = var AutoHideCursor =
module.AutoHideCursor = core.ImageGridFeatures.Feature({ module.AutoHideCursor = core.ImageGridFeatures.Feature({
title: '', title: '',
@ -1108,16 +1113,12 @@ module.AutoHideCursor = core.ImageGridFeatures.Feature({
.removeClass('cursor-hidden') .removeClass('cursor-hidden')
} }
// show right away... // show right away -- no threshold...
} else { } else {
that.ribbons.viewer that.ribbons.viewer
.removeClass('cursor-hidden') .removeClass('cursor-hidden')
} }
if(!viewer.prop('cursor-autohide')){
return
}
var timeout = that.config['cursor-autohide-timeout'] || 1000 var timeout = that.config['cursor-autohide-timeout'] || 1000
if(timeout && timeout > 0){ if(timeout && timeout > 0){
timer = setTimeout(function(){ timer = setTimeout(function(){
@ -1133,10 +1134,13 @@ module.AutoHideCursor = core.ImageGridFeatures.Feature({
} }
}) })
// do the base setup...
!viewer.prop('cursor-autohide') !viewer.prop('cursor-autohide')
&& viewer && viewer
.prop('cursor-autohide', true) .prop('cursor-autohide', true)
.addClass('cursor-hidden') .addClass('cursor-hidden')
// prevent multiple handlers...
.off('mousemove', this.__cursor_autohide_handler)
.mousemove(handler) .mousemove(handler)
// teardown... // teardown...
@ -1154,6 +1158,7 @@ module.AutoHideCursor = core.ImageGridFeatures.Feature({
// This will store/restore autohide state for single-image and ribbon // This will store/restore autohide state for single-image and ribbon
// views... // views...
// XXX might be a good idea to hide cursor on navigation in autohide mode...
var AutoHideCursorSingleImage = var AutoHideCursorSingleImage =
module.AutoHideCursorSingleImage = core.ImageGridFeatures.Feature({ module.AutoHideCursorSingleImage = core.ImageGridFeatures.Feature({
title: '', title: '',