mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added (crude) confirm function
This commit is contained in:
parent
1ca2c66b45
commit
4a93c1eead
@ -94,6 +94,7 @@ function readConfig(config: any) {
|
||||
}
|
||||
|
||||
function setupEvents() {
|
||||
|
||||
/* Generic clicks */
|
||||
document.addEventListener("click", (ev) => {
|
||||
if (ev instanceof MouseEvent && ev.target instanceof HTMLElement) {
|
||||
|
||||
@ -371,7 +371,6 @@ export class Unit extends Marker {
|
||||
}
|
||||
|
||||
delete() {
|
||||
// TODO: add confirmation popup
|
||||
deleteUnit(this.ID);
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ export class UnitsManager {
|
||||
document.addEventListener('paste', () => this.pasteUnits());
|
||||
document.addEventListener('unitSelection', (e: CustomEvent) => this.#onUnitSelection(e.detail));
|
||||
document.addEventListener('unitDeselection', (e: CustomEvent) => this.#onUnitDeselection(e.detail));
|
||||
document.addEventListener('keydown', (event) => this.#onKeyDown(event));
|
||||
document.addEventListener('keyup', (event) => this.#onKeyUp(event));
|
||||
document.addEventListener('deleteSelectedUnits', () => this.selectedUnitsDelete())
|
||||
}
|
||||
|
||||
@ -329,8 +329,8 @@ export class UnitsManager {
|
||||
}
|
||||
|
||||
/***********************************************/
|
||||
#onKeyDown(event: KeyboardEvent) {
|
||||
if (!keyEventWasInInput(event) && event.key === "Delete") {
|
||||
#onKeyUp(event: KeyboardEvent) {
|
||||
if (!keyEventWasInInput(event) && event.key === "Delete" && confirm( "Are you sure you want to delete?" ) ) {
|
||||
this.selectedUnitsDelete();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user