mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Fixed error in spawn menu (unable to select coalition) and cropped unit images for spawn menu
This commit is contained in:
@@ -67,6 +67,7 @@ export class Map extends L.Map {
|
||||
#panDown: boolean = false;
|
||||
|
||||
#lastMousePosition: L.Point = new L.Point(0, 0);
|
||||
#lastMouseCoordinates: L.LatLng = new L.LatLng(0, 0);
|
||||
|
||||
#shiftKey: boolean = false;
|
||||
#ctrlKey: boolean = false;
|
||||
@@ -168,7 +169,6 @@ export class Map extends L.Map {
|
||||
this.on('mousedown', (e: any) => this.#onMouseDown(e));
|
||||
this.on('mouseup', (e: any) => this.#onMouseUp(e));
|
||||
this.on('mousemove', (e: any) => this.#onMouseMove(e));
|
||||
this.on('drag', (e: any) => this.#onMouseMove(e));
|
||||
this.on('keydown', (e: any) => this.#onKeyDown(e));
|
||||
this.on('keyup', (e: any) => this.#onKeyUp(e));
|
||||
this.on('move', (e: any) => { if (this.#slaveDCSCamera) this.#broadcastPosition() });
|
||||
@@ -326,7 +326,7 @@ export class Map extends L.Map {
|
||||
|
||||
this.#updateCursor();
|
||||
|
||||
document.dispatchEvent(new CustomEvent("mapStateChanged"));
|
||||
document.dispatchEvent(new CustomEvent("mapStateChanged", { detail: this.#state }));
|
||||
}
|
||||
|
||||
getState() {
|
||||
@@ -437,7 +437,7 @@ export class Map extends L.Map {
|
||||
}
|
||||
|
||||
getMouseCoordinates() {
|
||||
return this.containerPointToLatLng(this.#lastMousePosition);
|
||||
return this.#lastMouseCoordinates;
|
||||
}
|
||||
|
||||
centerOnUnit(ID: number | null) {
|
||||
@@ -778,6 +778,7 @@ export class Map extends L.Map {
|
||||
#onMouseMove(e: any) {
|
||||
this.#lastMousePosition.x = e.originalEvent.x;
|
||||
this.#lastMousePosition.y = e.originalEvent.y;
|
||||
this.#lastMouseCoordinates = this.mouseEventToLatLng(e.originalEvent);
|
||||
|
||||
this.#updateCursor();
|
||||
|
||||
|
||||
@@ -51,6 +51,10 @@ export function SpawnMenu(props: {
|
||||
filteredAirDefense = filterUnits(filteredAirDefense, filterString);
|
||||
filteredGroundUnits = filterUnits(filteredGroundUnits, filterString);
|
||||
|
||||
/* When the menu is closed, reset the blueprint */
|
||||
if (!props.open && blueprint !== null)
|
||||
setBlueprint(null);
|
||||
|
||||
return <Menu {...props}
|
||||
title="Spawn menu"
|
||||
showBackButton={blueprint !== null}
|
||||
|
||||
@@ -44,7 +44,7 @@ export function UnitSpawnMenu(props: {
|
||||
altitude: ftToM(spawnAltitude),
|
||||
loadout: props.blueprint.loadouts?.find((loadout) => { return loadout.name === spawnLoadoutName})?.code ?? ""
|
||||
},
|
||||
coalition: 'blue'
|
||||
coalition: spawnCoalition
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import { MainMenu } from './panels/mainmenu'
|
||||
import { SideBar } from './panels/sidebar';
|
||||
import { Options } from './panels/options';
|
||||
import { MapHiddenTypes, MapOptions } from '../types/types'
|
||||
import { BLUE_COMMANDER, GAME_MASTER, MAP_HIDDEN_TYPES_DEFAULTS, MAP_OPTIONS_DEFAULTS, RED_COMMANDER } from '../constants/constants'
|
||||
import { BLUE_COMMANDER, GAME_MASTER, IDLE, MAP_HIDDEN_TYPES_DEFAULTS, MAP_OPTIONS_DEFAULTS, RED_COMMANDER } from '../constants/constants'
|
||||
import { getApp, setupApp } from '../olympusapp'
|
||||
import { LoginModal } from './modals/login'
|
||||
import { sha256 } from 'js-sha256'
|
||||
@@ -50,6 +50,12 @@ export function UI() {
|
||||
setMapOptions({ ...getApp().getMap().getOptions() });
|
||||
})
|
||||
|
||||
document.addEventListener("mapStateChanged", (ev) => {
|
||||
if ((ev as CustomEvent).detail == IDLE) {
|
||||
hideAllMenus();
|
||||
}
|
||||
})
|
||||
|
||||
function hideAllMenus() {
|
||||
setMainMenuVisible(false);
|
||||
setSpawnMenuVisible(false);
|
||||
|
||||
Reference in New Issue
Block a user