Fixed small bug related to the mouse PPI keys

canary
WolverinDEV 2019-10-29 22:23:05 +01:00
parent 3b3c9f2932
commit b1c3125688
1 changed files with 7 additions and 0 deletions

View File

@ -13,11 +13,15 @@ namespace Modals {
const button_save = modal.htmlTag.find(".button-save");
const button_cancel = modal.htmlTag.find(".button-cancel");
let current_key_age: number;
let last_key;
let current_key;
const listener = (event: ppt.KeyEvent) => {
if(event.type === ppt.EventType.KEY_PRESS) {
//console.log(tr("Key select got key press for %o"), event);
last_key = current_key;
current_key = event;
current_key_age = Date.now();
container_key.text(ppt.key_description(event));
button_save.prop("disabled", false);
@ -26,6 +30,9 @@ namespace Modals {
button_save.on('click', () => {
/* Because pressing the close button is also a mouse action */
if(current_key_age + 100 > Date.now())
current_key = last_key;
callback(current_key);
modal.close();
}).prop("disabled", true);