Quick keys disappear only after releasing alt key

Other changes:
- 0.2s delay so they don't appear when pressing Alt+A etc
- don't appear when other modifier keys are pressed
This commit is contained in:
Lorenz Hübschle-Schneider 2014-10-20 11:40:30 +02:00
parent 9827710736
commit 80b0d2ca6a
2 changed files with 16 additions and 15 deletions

View file

@ -327,16 +327,18 @@ table.notimestampseconds td.time span.seconds {
} }
#sidebar .showquickkeys .buffer .buffer-quick-key { #sidebar .showquickkeys .buffer .buffer-quick-key {
transition:all linear 1s; transition: all ease 0.5s;
-webkit-transition:all ease-out 1s; -webkit-transition: all ease 0.5s;
transition-delay: 0.2s;
-webkit-transition-delay: 0.2s;
opacity: 0.7; opacity: 0.7;
} }
#sidebar .buffer .buffer-quick-key { #sidebar .buffer .buffer-quick-key {
margin-left: -0.8em; margin-left: -0.7em;
margin-right: -0.2em; margin-right: -0.2em;
font-size: smaller; font-size: smaller;
transition:all linear 2s; transition: all ease 0.5s;
-webkit-transition:all ease-in 2s; -webkit-transition: all ease 0.5s;
opacity: 0; opacity: 0;
text-shadow: -1px 0px 4px rgba(255, 255, 255, 0.4), text-shadow: -1px 0px 4px rgba(255, 255, 255, 0.4),
0px -1px 4px rgba(255, 255, 255, 0.4), 0px -1px 4px rgba(255, 255, 255, 0.4),

View file

@ -362,9 +362,16 @@ weechat.directive('inputBar', function() {
$event.preventDefault(); $event.preventDefault();
return true; return true;
} }
// Alt key down -> display quick key legend // Alt key down -> display quick key legend
if ($event.type === "keydown" && code === 18) { if ($event.type === "keydown" && code === 18 && !$event.ctrlKey && !$event.shiftKey) {
$rootScope.showQuickKeys = true; $rootScope.showQuickKeys = true;
}
};
$rootScope.handleKeyRelease = function($event) {
// Alt key up -> remove quick key legend
if ($event.keyCode === 18) {
if ($rootScope.quickKeysTimer !== undefined) { if ($rootScope.quickKeysTimer !== undefined) {
clearTimeout($rootScope.quickKeysTimer); clearTimeout($rootScope.quickKeysTimer);
} }
@ -374,18 +381,10 @@ weechat.directive('inputBar', function() {
$rootScope.$apply(); $rootScope.$apply();
} }
delete $rootScope.quickKeysTimer; delete $rootScope.quickKeysTimer;
}, 3000); }, 1000);
return true; return true;
} }
}; };
$rootScope.handleKeyRelease = function($event) {
// Alt key up -> remove quick key legend
if ($event.keyCode === 18) {
if ($rootScope.showQuickKeys) {
$rootScope.showQuickKeys = false;
}
}
};
}] }]
}; };
}); });