From 0558227ce693050edf0f9f26104ca56e982be63d Mon Sep 17 00:00:00 2001 From: MarcoJayUsai Date: Fri, 28 Mar 2025 19:16:09 +0100 Subject: [PATCH 1/2] refactor(drawings): reduced the zoom of the go to drawing feature --- frontend/react/src/ui/panels/drawingmenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/react/src/ui/panels/drawingmenu.tsx b/frontend/react/src/ui/panels/drawingmenu.tsx index bfd5bee3..6433a136 100644 --- a/frontend/react/src/ui/panels/drawingmenu.tsx +++ b/frontend/react/src/ui/panels/drawingmenu.tsx @@ -170,7 +170,7 @@ export function DrawingMenu(props: { open: boolean; onClose: () => void }) { onClick={() => { const latLng = drawing.getLayer()["getLatLng"] && drawing.getLayer()["getLatLng"](); const bounds = drawing.getLayer()["getBounds"] && drawing.getLayer()["getBounds"](); - latLng && getApp().getMap().setView(latLng, 14); + latLng && getApp().getMap().setView(latLng, 10); bounds && getApp().getMap().fitBounds(bounds); }} /> From 3814052fd9bb5b9220b462a232a107328081fb6d Mon Sep 17 00:00:00 2001 From: MarcoJayUsai Date: Fri, 28 Mar 2025 19:21:59 +0100 Subject: [PATCH 2/2] feat(navpoints): added header button to quick toggle navpoints drawing --- frontend/react/src/constants/constants.ts | 1 + .../react/src/map/drawings/drawingsmanager.ts | 2 + frontend/react/src/types/types.ts | 1 + frontend/react/src/ui/panels/header.tsx | 99 ++++++++++--------- 4 files changed, 58 insertions(+), 45 deletions(-) diff --git a/frontend/react/src/constants/constants.ts b/frontend/react/src/constants/constants.ts index 8264596b..58970552 100644 --- a/frontend/react/src/constants/constants.ts +++ b/frontend/react/src/constants/constants.ts @@ -419,6 +419,7 @@ export const MAP_OPTIONS_DEFAULTS: MapOptions = { hideChromeWarning: false, hideSecureWarning: false, showMissionDrawings: false, + showMissionNavpoints: false, clusterGroundUnits: true, showUnitCallsigns: true, }; diff --git a/frontend/react/src/map/drawings/drawingsmanager.ts b/frontend/react/src/map/drawings/drawingsmanager.ts index 4de83577..108bda5e 100644 --- a/frontend/react/src/map/drawings/drawingsmanager.ts +++ b/frontend/react/src/map/drawings/drawingsmanager.ts @@ -714,6 +714,7 @@ export class DrawingsManager { MapOptionsChangedEvent.on((mapOptions: MapOptions) => { this.#drawingsContainer.setVisibility(mapOptions.showMissionDrawings); + this.#navpointsContainer.setVisibility(mapOptions.showMissionNavpoints); }); SessionDataLoadedEvent.on((sessionData) => { @@ -724,6 +725,7 @@ export class DrawingsManager { if (this.#sessionDataNavpoints["Navpoints"]) this.#navpointsContainer.fromJSON(this.#sessionDataNavpoints["Navpoints"]); } this.#drawingsContainer.setVisibility(getApp().getMap().getOptions().showMissionDrawings); + this.#navpointsContainer.setVisibility(getApp().getMap().getOptions().showMissionNavpoints); }); } diff --git a/frontend/react/src/types/types.ts b/frontend/react/src/types/types.ts index d733f5d7..8e9a57e5 100644 --- a/frontend/react/src/types/types.ts +++ b/frontend/react/src/types/types.ts @@ -31,6 +31,7 @@ export type MapOptions = { hideChromeWarning: boolean; hideSecureWarning: boolean; showMissionDrawings: boolean; + showMissionNavpoints: boolean; clusterGroundUnits: boolean; showUnitCallsigns: boolean; }; diff --git a/frontend/react/src/ui/panels/header.tsx b/frontend/react/src/ui/panels/header.tsx index 9f0cabde..f6b520d1 100644 --- a/frontend/react/src/ui/panels/header.tsx +++ b/frontend/react/src/ui/panels/header.tsx @@ -1,21 +1,17 @@ +import { faCompass } from "@fortawesome/free-regular-svg-icons"; +import { faCamera, faDrawPolygon, faFlag, faObjectGroup, faSkull, faTriangleExclamation, faVolumeHigh, faWifi } from "@fortawesome/free-solid-svg-icons"; import React, { useEffect, useRef, useState } from "react"; -import { OlRoundStateButton, OlStateButton, OlLockStateButton } from "../components/olstatebutton"; -import { faSkull, faCamera, faFlag, faVolumeHigh, faDrawPolygon, faTriangleExclamation, faWifi, faObjectGroup } from "@fortawesome/free-solid-svg-icons"; -import { OlDropdownItem, OlDropdown } from "../components/oldropdown"; -import { OlLabelToggle } from "../components/ollabeltoggle"; -import { getApp, IP, VERSION } from "../../olympusapp"; -import { - olButtonsVisibilityAirbase, - olButtonsVisibilityAircraft, - olButtonsVisibilityDcs, - olButtonsVisibilityGroundunit, - olButtonsVisibilityGroundunitSam, - olButtonsVisibilityHelicopter, - olButtonsVisibilityHuman, - olButtonsVisibilityNavyunit, - olButtonsVisibilityOlympus, -} from "../components/olicons"; +import { FaCheck, FaRedo, FaSpinner } from "react-icons/fa"; import { FaChevronLeft, FaChevronRight, FaFloppyDisk } from "react-icons/fa6"; +import { + AudioManagerState, + BLUE_COMMANDER, + COMMAND_MODE_OPTIONS_DEFAULTS, + GAME_MASTER, + MAP_HIDDEN_TYPES_DEFAULTS, + MAP_OPTIONS_DEFAULTS, + RED_COMMANDER, +} from "../../constants/constants"; import { AudioManagerStateChangedEvent, CommandModeOptionsChangedEvent, @@ -27,21 +23,23 @@ import { SessionDataChangedEvent, SessionDataSavedEvent, } from "../../events"; -import { - AudioManagerState, - BLUE_COMMANDER, - COMMAND_MODE_OPTIONS_DEFAULTS, - GAME_MASTER, - LoginSubState, - MAP_HIDDEN_TYPES_DEFAULTS, - MAP_OPTIONS_DEFAULTS, - OlympusState, - RED_COMMANDER, -} from "../../constants/constants"; import { OlympusConfig } from "../../interfaces"; -import { FaCheck, FaRedo, FaSpinner } from "react-icons/fa"; +import { getApp, IP, VERSION } from "../../olympusapp"; +import { OlDropdown, OlDropdownItem } from "../components/oldropdown"; import { OlExpandingTooltip } from "../components/olexpandingtooltip"; -import { stat } from "fs"; +import { + olButtonsVisibilityAirbase, + olButtonsVisibilityAircraft, + olButtonsVisibilityDcs, + olButtonsVisibilityGroundunit, + olButtonsVisibilityGroundunitSam, + olButtonsVisibilityHelicopter, + olButtonsVisibilityHuman, + olButtonsVisibilityNavyunit, + olButtonsVisibilityOlympus, +} from "../components/olicons"; +import { OlLabelToggle } from "../components/ollabeltoggle"; +import { OlLockStateButton, OlRoundStateButton, OlStateButton } from "../components/olstatebutton"; export function Header() { const [mapHiddenTypes, setMapHiddenTypes] = useState(MAP_HIDDEN_TYPES_DEFAULTS); @@ -251,13 +249,9 @@ export function Header() { Game Master {enabledCommandModes.length > 0 && ( <> - {loadingNewCommandMode ? ( - - ) : ( - - )} + {loadingNewCommandMode ? : } )} @@ -283,9 +277,9 @@ export function Header() { {enabledCommandModes.length > 0 && ( <> {loadingNewCommandMode ? ( - + ) : ( )} @@ -314,9 +308,9 @@ export function Header() { {enabledCommandModes.length > 0 && ( <> {loadingNewCommandMode ? ( - + ) : ( )} @@ -351,9 +345,11 @@ export function Header() { onClick={() => { audioState === AudioManagerState.RUNNING ? getApp().getAudioManager().stop() : getApp().getAudioManager().start(); }} - className={audioState === AudioManagerState.ERROR ? ` - animate-pulse !border-red-500 !text-red-500 - ` : ""} + className={ + audioState === AudioManagerState.ERROR + ? `animate-pulse !border-red-500 !text-red-500` + : "" + } tooltip={() => ( )} /> + { + getApp().getMap().setOption("showMissionNavpoints", !mapOptions.showMissionNavpoints); + }} + tooltip={() => ( + + )} + /> getApp().getMap().setOption("showUnitsEngagementRings", !mapOptions.showUnitsEngagementRings)} checked={mapOptions.showUnitsEngagementRings}