more cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-08-27 13:15:08 +03:00
parent 9517f90f1e
commit fbb8860a49
2 changed files with 46 additions and 70 deletions

View File

@ -84,7 +84,6 @@ core.ImageGridFeatures.Feature('viewer-testing', [
// features... // features...
'ui-cursor', 'ui-cursor',
'ui-unfocused-lock',
'ui-single-image', 'ui-single-image',

View File

@ -1232,10 +1232,49 @@ module.Cursor = core.ImageGridFeatures.Feature({
/*********************************************************************/ /*********************************************************************/
// Lock mouse when unfocused... // Touch/Control...
//
// .__control_in_progress
// Long interactions can set .__control_in_progress a number while
// in progress and remove it when done.
// Each new interaction should increment this when starting and
// decrement when done.
// This should be removed when 0
//
// This is to enable other events to handle the situation gracefully
//
// XXX how should multiple long interactions be handled??
// XXX revise...
//
// NOTE: modifies .ribbons -- event handlers, attrs, classes... (XXX)
// NOTE: for legacy stuff see: features/ui-legacy.js
//
// XXX add option to block click actions on focus...
// ...this is already done in widget.overlay, but I think should be
// system-wide...
var LockUnfocusedActions = actions.Actions({ // XXX STUB: needs more thought....
var ControlActions = actions.Actions({
config: { config: {
'control-mode': 'indirect',
// This can be:
// 'silent' - silently focus central image after pan
// true - focus central image after pan
// null - do nothing.
'focus-central-image': 'silent',
'ribbon-pan-threshold': 30,
'control-in-progress-timeout': 100,
'animation-frame-renderer': true,
// if true and ribbon is panned off screen, the image will be
// centered, else behave just like partially off screen...
'center-off-screen-paned-images': false,
'mouse-wheel-scale': 0.5,
'lock-unfocused': 'on', 'lock-unfocused': 'on',
// The timeout to wait after window focus before unlocking the // The timeout to wait after window focus before unlocking the
@ -1243,6 +1282,7 @@ var LockUnfocusedActions = actions.Actions({
'window-focus-timeout': 200, 'window-focus-timeout': 200,
}, },
// Lock unfocused viewer...
toggleUnfocusedLock: ['Interface/Lock unfocused viewer', toggleUnfocusedLock: ['Interface/Lock unfocused viewer',
core.doc`Toggle unfocused viewer locking... core.doc`Toggle unfocused viewer locking...
@ -1291,73 +1331,6 @@ var LockUnfocusedActions = actions.Actions({
delete this.__focus_lock_handlers delete this.__focus_lock_handlers
} }
})], })],
})
var LockUnfocused =
module.LockUnfocused = core.ImageGridFeatures.Feature({
title: '',
doc: '',
tag: 'ui-unfocused-lock',
depends: [
'ui'
],
actions: LockUnfocusedActions,
handlers: [
['start',
function(){
this.toggleUnfocusedLock('!') }],
],
})
/*********************************************************************/
// Touch/Control...
//
// .__control_in_progress
// Long interactions can set .__control_in_progress a number while
// in progress and remove it when done.
// Each new interaction should increment this when starting and
// decrement when done.
// This should be removed when 0
//
// This is to enable other events to handle the situation gracefully
//
// XXX how should multiple long interactions be handled??
// XXX revise...
//
// NOTE: modifies .ribbons -- event handlers, attrs, classes... (XXX)
// NOTE: for legacy stuff see: features/ui-legacy.js
//
// XXX add option to block click actions on focus...
// ...this is already done in widget.overlay, but I think should be
// system-wide...
// XXX STUB: needs more thought....
var ControlActions = actions.Actions({
config: {
'control-mode': 'indirect',
// This can be:
// 'silent' - silently focus central image after pan
// true - focus central image after pan
// null - do nothing.
'focus-central-image': 'silent',
'ribbon-pan-threshold': 30,
'control-in-progress-timeout': 100,
'animation-frame-renderer': true,
// if true and ribbon is panned off screen, the image will be
// centered, else behave just like partially off screen...
'center-off-screen-paned-images': false,
'mouse-wheel-scale': 0.5,
},
// Image click events... // Image click events...
imageOuterBlockClick: ['- Interface/Image outer block click event', imageOuterBlockClick: ['- Interface/Image outer block click event',
@ -2173,6 +2146,10 @@ module.Control = core.ImageGridFeatures.Feature({
actions: ControlActions, actions: ControlActions,
handlers: [ handlers: [
['start',
function(){
this.toggleUnfocusedLock('!')
}],
['load', ['load',
function(){ function(){
this.toggleImageClickHandling('on') this.toggleImageClickHandling('on')