Fixed small bug related to the mouse PPI keys
parent
3b3c9f2932
commit
b1c3125688
|
@ -13,11 +13,15 @@ namespace Modals {
|
||||||
const button_save = modal.htmlTag.find(".button-save");
|
const button_save = modal.htmlTag.find(".button-save");
|
||||||
const button_cancel = modal.htmlTag.find(".button-cancel");
|
const button_cancel = modal.htmlTag.find(".button-cancel");
|
||||||
|
|
||||||
|
let current_key_age: number;
|
||||||
|
let last_key;
|
||||||
let current_key;
|
let current_key;
|
||||||
const listener = (event: ppt.KeyEvent) => {
|
const listener = (event: ppt.KeyEvent) => {
|
||||||
if(event.type === ppt.EventType.KEY_PRESS) {
|
if(event.type === ppt.EventType.KEY_PRESS) {
|
||||||
//console.log(tr("Key select got key press for %o"), event);
|
//console.log(tr("Key select got key press for %o"), event);
|
||||||
|
last_key = current_key;
|
||||||
current_key = event;
|
current_key = event;
|
||||||
|
current_key_age = Date.now();
|
||||||
|
|
||||||
container_key.text(ppt.key_description(event));
|
container_key.text(ppt.key_description(event));
|
||||||
button_save.prop("disabled", false);
|
button_save.prop("disabled", false);
|
||||||
|
@ -26,6 +30,9 @@ namespace Modals {
|
||||||
|
|
||||||
|
|
||||||
button_save.on('click', () => {
|
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);
|
callback(current_key);
|
||||||
modal.close();
|
modal.close();
|
||||||
}).prop("disabled", true);
|
}).prop("disabled", true);
|
||||||
|
|
Loading…
Reference in New Issue