Ajout d'un délai minimum de 2s entre deux clics pour éviter des lancements intempestifs d'applications. Fixes #4
This commit is contained in:
parent
8ad1c3055a
commit
3ded369d09
@ -8,9 +8,11 @@ var connect = require('react-redux').connect;
|
||||
var logger = require('../../util/logger');
|
||||
var CrossfadeImage = require('../common/crossfade-image');
|
||||
var path = require('path');
|
||||
var _ = require('lodash');
|
||||
|
||||
var DEFAULT_PROFILE = path.join(__dirname, '..', '..', '..', 'default-profile.json');
|
||||
var DEFAULT_BACKGROUND = '';
|
||||
var MIN_CLICK_DELTATIME = 2000;
|
||||
|
||||
var LauncherView = React.createClass({
|
||||
|
||||
@ -19,7 +21,8 @@ var LauncherView = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
currentItemPath: '',
|
||||
currentItem: null
|
||||
currentItem: null,
|
||||
lastClickTimestamp: 0
|
||||
};
|
||||
},
|
||||
|
||||
@ -90,6 +93,12 @@ var LauncherView = React.createClass({
|
||||
|
||||
logger.debug(item);
|
||||
|
||||
var clickDeltaTime = Date.now() - this.state.lastClickTimestamp;
|
||||
if( clickDeltaTime < MIN_CLICK_DELTATIME ) {
|
||||
logger.debug('Item clicked within %sms. No action.', MIN_CLICK_DELTATIME);
|
||||
return;
|
||||
}
|
||||
|
||||
if(item.items) {
|
||||
|
||||
this.play(this.refs.appList, 'slide-out-left 250ms ease-in-out')
|
||||
@ -117,6 +126,8 @@ var LauncherView = React.createClass({
|
||||
logger.info('No action associated with item "'+item.label+'".');
|
||||
}
|
||||
|
||||
this.setState({ lastClickTimestamp: Date.now() });
|
||||
|
||||
},
|
||||
|
||||
_getItemByPath: function(itemPath, rootItem) {
|
||||
|
Loading…
Reference in New Issue
Block a user