mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Merge pull request #168 from Pax1601/155-pasting-units-generates-many-units-if-ctrl+v-is-held-down
Maximum paste rate set to once every 250ms
This commit is contained in:
@@ -8,6 +8,7 @@ export class UnitsManager {
|
|||||||
#units: { [ID: number]: Unit };
|
#units: { [ID: number]: Unit };
|
||||||
#copiedUnits: Unit[];
|
#copiedUnits: Unit[];
|
||||||
#selectionEventDisabled: boolean = false;
|
#selectionEventDisabled: boolean = false;
|
||||||
|
#pasteDisabled: boolean = false;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.#units = {};
|
this.#units = {};
|
||||||
@@ -330,10 +331,15 @@ export class UnitsManager {
|
|||||||
|
|
||||||
pasteUnits()
|
pasteUnits()
|
||||||
{
|
{
|
||||||
for (let idx in this.#copiedUnits)
|
if (!this.#pasteDisabled)
|
||||||
{
|
{
|
||||||
var unit = this.#copiedUnits[idx];
|
for (let idx in this.#copiedUnits)
|
||||||
cloneUnit(unit.ID, getMap().getMouseCoordinates());
|
{
|
||||||
|
var unit = this.#copiedUnits[idx];
|
||||||
|
cloneUnit(unit.ID, getMap().getMouseCoordinates());
|
||||||
|
}
|
||||||
|
this.#pasteDisabled = true;
|
||||||
|
setTimeout(() => this.#pasteDisabled = false, 250);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user