mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Merge pull request #474 from Pax1601/460-sam-threat-rings-appear-when-they-shouldnt
460 sam threat rings appear when they shouldnt
This commit is contained in:
@@ -18,6 +18,7 @@ export class MapContextMenu extends ContextMenu {
|
||||
#groundUnitSpawnMenu: GroundUnitSpawnMenu;
|
||||
#navyUnitSpawnMenu: NavyUnitSpawnMenu;
|
||||
#coalitionArea: CoalitionArea | null = null;
|
||||
#selectedUnitCategory: string = "";
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -39,9 +40,10 @@ export class MapContextMenu extends ContextMenu {
|
||||
|
||||
/* Event listeners */
|
||||
document.addEventListener("mapContextMenuShow", (e: any) => {
|
||||
if (this.getVisibleSubMenu() !== e.detail.type)
|
||||
if (this.getVisibleSubMenu() !== e.detail.type) {
|
||||
this.#showSubMenu(e.detail.type);
|
||||
else
|
||||
this.#selectedUnitCategory = e.detail.type;
|
||||
} else
|
||||
this.#hideSubMenus(e.detail.type);
|
||||
});
|
||||
|
||||
@@ -65,9 +67,9 @@ export class MapContextMenu extends ContextMenu {
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("commandModeOptionsChanged", (e: any) => {
|
||||
//this.#refreshOptions();
|
||||
});
|
||||
// document.addEventListener("commandModeOptionsChanged", (e: any) => {
|
||||
// //this.#refreshOptions();
|
||||
// });
|
||||
|
||||
this.#aircraftSpawnMenu.getContainer().addEventListener("resize", () => this.clip());
|
||||
this.#helicopterSpawnMenu.getContainer().addEventListener("resize", () => this.clip());
|
||||
|
||||
@@ -50,6 +50,7 @@ export class UnitSpawnMenu {
|
||||
/* Range circle previews */
|
||||
#engagementCircle: Circle;
|
||||
#acquisitionCircle: Circle;
|
||||
protected showRangeCircles: boolean = false;
|
||||
|
||||
constructor(ID: string, unitDatabase: UnitDatabase, orderByRole: boolean) {
|
||||
this.#container = document.getElementById(ID) as HTMLElement;
|
||||
@@ -244,6 +245,10 @@ export class UnitSpawnMenu {
|
||||
return this.#container;
|
||||
}
|
||||
|
||||
getVisible() {
|
||||
return !this.getContainer().classList.contains( "hide" );
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.#deployUnitButtonEl.disabled = true;
|
||||
this.#unitRoleTypeDropdown.reset();
|
||||
@@ -286,9 +291,17 @@ export class UnitSpawnMenu {
|
||||
|
||||
showCirclesPreviews() {
|
||||
this.clearCirclesPreviews();
|
||||
|
||||
if ( !this.showRangeCircles || this.spawnOptions.name === "" || !this.getVisible() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var acquisitionRange = this.#unitDatabase.getByName(this.spawnOptions.name)?.acquisitionRange ?? 0;
|
||||
var engagementRange = this.#unitDatabase.getByName(this.spawnOptions.name)?.engagementRange ?? 0;
|
||||
let acquisitionRange = this.#unitDatabase.getByName(this.spawnOptions.name)?.acquisitionRange ?? 0;
|
||||
let engagementRange = this.#unitDatabase.getByName(this.spawnOptions.name)?.engagementRange ?? 0;
|
||||
|
||||
if ( acquisitionRange === 0 && engagementRange === 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.#acquisitionCircle.setRadius(acquisitionRange);
|
||||
this.#engagementCircle.setRadius(engagementRange);
|
||||
@@ -569,6 +582,9 @@ export class HelicopterSpawnMenu extends UnitSpawnMenu {
|
||||
}
|
||||
|
||||
export class GroundUnitSpawnMenu extends UnitSpawnMenu {
|
||||
|
||||
protected showRangeCircles: boolean = true;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ID - the ID of the HTML element which will contain the context menu
|
||||
|
||||
Reference in New Issue
Block a user