diff --git a/frontend/react/.vscode/extensions.json b/frontend/react/.vscode/extensions.json
new file mode 100644
index 00000000..9d9323cc
--- /dev/null
+++ b/frontend/react/.vscode/extensions.json
@@ -0,0 +1,6 @@
+{
+ "recommendations": [
+ "esbenp.prettier-vscode",
+ "dbaeumer.vscode-eslint"
+ ]
+}
\ No newline at end of file
diff --git a/frontend/react/src/constants/constants.ts b/frontend/react/src/constants/constants.ts
index 755afe76..70de3819 100644
--- a/frontend/react/src/constants/constants.ts
+++ b/frontend/react/src/constants/constants.ts
@@ -1,5 +1,5 @@
import { LatLng, LatLngBounds } from "leaflet";
-import { Context } from "../types/types";
+import { Context, MapOptions } from "../types/types";
export const DEFAULT_CONTEXT: Context = "default context";
@@ -292,7 +292,8 @@ export const MAP_OPTIONS_DEFAULTS = {
showUnitsEngagementRings: true,
showUnitsAcquisitionRings: true,
fillSelectedRing: false,
-};
+ showMinimap: false
+} as MapOptions;
export const MAP_HIDDEN_TYPES_DEFAULTS = {
human: false,
diff --git a/frontend/react/src/index.css b/frontend/react/src/index.css
index 9b0f946e..138c3cd9 100644
--- a/frontend/react/src/index.css
+++ b/frontend/react/src/index.css
@@ -31,3 +31,8 @@
.z-ui-4 {
z-index: 2004;
}
+
+.z-ui-5 {
+ z-index: 2005;
+}
+
diff --git a/frontend/react/src/map/map.ts b/frontend/react/src/map/map.ts
index 4ba44740..f2d015fd 100644
--- a/frontend/react/src/map/map.ts
+++ b/frontend/react/src/map/map.ts
@@ -123,6 +123,7 @@ export class Map extends L.Map {
#cameraZoomRatio: number = 1.0;
#contextAction: null | ContextAction = null;
+ #theatre: string = "";
/**
*
@@ -157,17 +158,6 @@ export class Map extends L.Map {
this.#miniMapPolyline = new L.Polyline([], { color: "#202831" });
this.#miniMapPolyline.addTo(this.#miniMapLayerGroup);
- /* Scale */
- //@ts-ignore TODO more hacking because the module is provided as a pure javascript module only
- //L.control.scalenautic({ position: "topright", maxWidth: 300, nautic: true, metric: true, imperial: false }).addTo(this);
-
- /* Map source dropdown */
- //this.#mapSourceDropdown = new Dropdown("map-type", (layerName: string) => this.setLayer(layerName));
- //this.#mapSourceDropdown.setOptions(this.getLayers(), null);
- //
- ///* Visibility options dropdown */
- //this.#mapVisibilityOptionsDropdown = new Dropdown("map-visibility-options", (value: string) => { });
-
/* Init the state machine */
this.#state = IDLE;
@@ -235,6 +225,8 @@ export class Map extends L.Map {
this.#broadcastPosition();
}, 500); // DCS does not always apply the altitude correctly at the first set when changing map type
}
+
+ this.updateMinimap();
});
document.addEventListener("configLoaded", () => {
@@ -567,29 +559,16 @@ export class Map extends L.Map {
}
setTheatre(theatre: string) {
+ this.#theatre = theatre;
+
var bounds = new L.LatLngBounds([-90, -180], [90, 180]);
- var miniMapZoom = 5;
if (theatre in mapBounds) {
bounds = mapBounds[theatre as keyof typeof mapBounds].bounds;
- miniMapZoom = mapBounds[theatre as keyof typeof mapBounds].zoom;
}
this.setView(bounds.getCenter(), 8);
- if (this.#miniMap) this.#miniMap.remove();
-
- //@ts-ignore // Needed because some of the inputs are wrong in the original module interface
- this.#miniMap = new ClickableMiniMap(this.#miniMapLayerGroup, {
- position: "topright",
- width: 192 * 1.5,
- height: 108 * 1.5,
- zoomLevelFixed: miniMapZoom,
- centerFixed: bounds.getCenter(),
- }).addTo(this);
- this.#miniMap.disableInteractivity();
- this.#miniMap.getMap().on("click", (e: any) => {
- if (this.#miniMap) this.setView(e.latlng);
- });
+ this.updateMinimap();
const boundaries = this.#getMinimapBoundaries();
this.#miniMapPolyline.setLatLngs(
@@ -599,6 +578,33 @@ export class Map extends L.Map {
this.setLayerName(this.#layerName);
}
+ updateMinimap() {
+ if (this.#miniMap) this.#miniMap.remove();
+
+ if (this.#options.showMinimap) {
+ var bounds = new L.LatLngBounds([-90, -180], [90, 180]);
+ var miniMapZoom = 5;
+ if (this.#theatre in mapBounds) {
+ bounds = mapBounds[this.#theatre as keyof typeof mapBounds].bounds;
+ miniMapZoom = mapBounds[this.#theatre as keyof typeof mapBounds].zoom;
+ }
+
+ this.#miniMap = new ClickableMiniMap(this.#miniMapLayerGroup, {
+ position: "topright",
+ width: 192 * 1.5,
+ height: 108 * 1.5,
+ //@ts-ignore Needed because some of the inputs are wrong in the original module interface
+ zoomLevelFixed: miniMapZoom,
+ //@ts-ignore Needed because some of the inputs are wrong in the original module interface
+ centerFixed: bounds.getCenter(),
+ }).addTo(this);
+ this.#miniMap.disableInteractivity();
+ this.#miniMap.getMap().on("click", (e: any) => {
+ if (this.#miniMap) this.setView(e.latlng);
+ });
+ }
+ }
+
getMiniMapLayerGroup() {
return this.#miniMapLayerGroup;
}
@@ -1092,13 +1098,11 @@ export class Map extends L.Map {
#showDestinationCursors() {
const singleCursor = !this.#shiftKey;
- const selectedUnitsCount = getApp()
- .getUnitsManager()
- .getSelectedUnits({
- excludeHumans: true,
- excludeProtected: true,
- onlyOnePerGroup: true,
- }).length;
+ const selectedUnitsCount = getApp().getUnitsManager().getSelectedUnits({
+ excludeHumans: true,
+ excludeProtected: true,
+ onlyOnePerGroup: true,
+ }).length;
if (singleCursor) {
this.#hideDestinationCursors();
} else if (!singleCursor) {
@@ -1126,13 +1130,11 @@ export class Map extends L.Map {
}
#updateDestinationCursors() {
- const selectedUnitsCount = getApp()
- .getUnitsManager()
- .getSelectedUnits({
- excludeHumans: true,
- excludeProtected: true,
- onlyOnePerGroup: true,
- }).length;
+ const selectedUnitsCount = getApp().getUnitsManager().getSelectedUnits({
+ excludeHumans: true,
+ excludeProtected: true,
+ onlyOnePerGroup: true,
+ }).length;
if (selectedUnitsCount > 1) {
const groupLatLng =
this.#computeDestinationRotation &&
diff --git a/frontend/react/src/types/types.ts b/frontend/react/src/types/types.ts
index 5bc5ef7c..da3a7319 100644
--- a/frontend/react/src/types/types.ts
+++ b/frontend/react/src/types/types.ts
@@ -19,6 +19,7 @@ export type MapOptions = {
showUnitsEngagementRings: boolean;
showUnitsAcquisitionRings: boolean;
fillSelectedRing: boolean;
+ showMinimap: boolean;
};
export type MapHiddenTypes = {
diff --git a/frontend/react/src/ui/components/oldropdown.tsx b/frontend/react/src/ui/components/oldropdown.tsx
index 9fbe64b6..cf27c716 100644
--- a/frontend/react/src/ui/components/oldropdown.tsx
+++ b/frontend/react/src/ui/components/oldropdown.tsx
@@ -106,10 +106,7 @@ export function OlDropdown(props: {
type="button"
>
{props.leftIcon && (
-
+
)}
{props.label}
@@ -138,7 +135,7 @@ export function OlDropdown(props: {
ref={contentRef}
data-open={open}
className={`
- absolute z-ui-2 w-full divide-y divide-gray-100 overflow-y-scroll
+ absolute z-ui-4 w-full divide-y divide-gray-100 overflow-y-scroll
rounded-lg bg-white p-2 shadow
dark:bg-gray-700
data-[open='false']:hidden
diff --git a/frontend/react/src/ui/modals/login.tsx b/frontend/react/src/ui/modals/login.tsx
index 990c53bf..3c3f74f8 100644
--- a/frontend/react/src/ui/modals/login.tsx
+++ b/frontend/react/src/ui/modals/login.tsx
@@ -38,7 +38,7 @@ export function LoginModal(props: {