Added throttle for checkCursorMenu, gain much better input performance

This commit is contained in:
Cheng-Han, Wu 2016-02-25 13:45:02 +08:00
parent fae3c02bb2
commit 8b16e0723d
1 changed files with 4 additions and 1 deletions

View File

@ -52,6 +52,7 @@ var defaultExtraKeys = {
var idleTime = 300000; //5 mins
var updateViewDebounce = 200;
var cursorMenuThrottle = 100;
var cursorActivityDebounce = 50;
var cursorAnimatePeriod = 100;
var supportCodeModes = ['javascript', 'htmlmixed', 'htmlembedded', 'css', 'xml', 'clike', 'clojure', 'ruby', 'python', 'shell', 'php', 'sql', 'coffeescript', 'yaml', 'jade', 'lua', 'cmake', 'nginx', 'perl', 'sass', 'r', 'dockerfile'];
@ -2340,7 +2341,9 @@ if ($('.cursor-menu').length <= 0) {
var upSideDown = false;
function checkCursorMenu() {
var checkCursorMenu = _.throttle(checkCursorMenuInner, cursorMenuThrottle);
function checkCursorMenuInner() {
var menuMargin = 60;
var dropdown = $('.cursor-menu .dropdown-menu');
if (dropdown.length <= 0) return;