From 13d49e6b5fde6057874487d73c4985089faed88e Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Fri, 24 Mar 2023 09:13:35 +0100 Subject: [PATCH 1/2] Menu now closes when clicking --- client/src/map/map.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/map/map.ts b/client/src/map/map.ts index 5fd71279..626532d5 100644 --- a/client/src/map/map.ts +++ b/client/src/map/map.ts @@ -228,6 +228,7 @@ export class Map extends L.Map { #onMouseDown(e: any) { + this.hideAllContextMenus(); if ((e.originalEvent.which == 1) && (e.originalEvent.button == 0)) this.dragging.disable(); } From f3b872f89cdaf525e68b3bde70a973f67aee80ae Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Fri, 24 Mar 2023 09:22:20 +0100 Subject: [PATCH 2/2] Menu spawn fixed --- client/src/controls/mapcontextmenu.ts | 13 +++++++++---- client/views/contextmenus.ejs | 10 +++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/client/src/controls/mapcontextmenu.ts b/client/src/controls/mapcontextmenu.ts index 1723dc22..235f5b7d 100644 --- a/client/src/controls/mapcontextmenu.ts +++ b/client/src/controls/mapcontextmenu.ts @@ -1,6 +1,6 @@ import { LatLng } from "leaflet"; import { getActiveCoalition, setActiveCoalition } from ".."; -import { spawnAircraft, spawnGroundUnit } from "../server/server"; +import { spawnAircraft, spawnGroundUnit, spawnSmoke } from "../server/server"; import { aircraftDatabase } from "../units/aircraftdatabase"; import { groundUnitsDatabase } from "../units/groundunitsdatabase"; import { ContextMenu } from "./contextmenu"; @@ -35,21 +35,26 @@ export class MapContextMenu extends ContextMenu { document.addEventListener("contextMenuShow", (e: any) => { this.showSubMenu(e.detail.type); - }) + }); document.addEventListener("contextMenuDeployAircraft", () => { this.hide(); this.#spawnOptions.coalition = getActiveCoalition(); if (this.#spawnOptions) spawnAircraft(this.#spawnOptions); - }) + }); document.addEventListener("contextMenuDeployGroundUnit", () => { this.hide(); this.#spawnOptions.coalition = getActiveCoalition(); if (this.#spawnOptions) spawnGroundUnit(this.#spawnOptions); - }) + }); + + document.addEventListener("contextMenuDeploySmoke", (e: any) => { + this.hide(); + spawnSmoke(e.detail.color, this.getLatLng()); + }); this.hide(); } diff --git a/client/views/contextmenus.ejs b/client/views/contextmenus.ejs index b9104ca0..b386ec9a 100644 --- a/client/views/contextmenus.ejs +++ b/client/views/contextmenus.ejs @@ -67,11 +67,11 @@
- - - - - + + + + +