-
{ }}>
-
Toggle Detection lines
+
{ getApp().getMap().setOption("showUnitTargets", !props.options.showUnitTargets) }}
+ >
+
{ }}>
+
Show Detection lines
+
F
-
-
{ }}>
-
Toggle Radar lines
+
{ getApp().getMap().setOption("hideUnitsShortRangeRings", !props.options.hideUnitsShortRangeRings) }}
+ >
+
{ }}>
+
Hide Short range Rings
+
R
-
-
{ }}>
-
Toggle Something Else
+
{ getApp().getMap().setOption("hideGroupMembers", !props.options.hideGroupMembers) }}
+ >
+
{ }}>
+
Hide Group members
+
G
+
+ {/*
@@ -71,7 +96,7 @@ export function Options(props: {
onChange={(ev) => { }}
/>
-
+
*/}
}
\ No newline at end of file
diff --git a/frontend/react/src/ui/ui.tsx b/frontend/react/src/ui/ui.tsx
index c6ef52e2..8ae0dbe5 100644
--- a/frontend/react/src/ui/ui.tsx
+++ b/frontend/react/src/ui/ui.tsx
@@ -42,6 +42,8 @@ export function UI() {
var [checkingPassword, setCheckingPassword] = useState(false);
var [loginError, setLoginError] = useState(false);
var [commandMode, setCommandMode] = useState(null as null | string);
+ var [mapSources, setMapSources] = useState([] as string[]);
+ var [activeMapSource, setActiveMapSource] = useState("");
document.addEventListener("hiddenTypesChanged", (ev) => {
setMapHiddenTypes({ ...getApp().getMap().getHiddenTypes() });
@@ -57,6 +59,20 @@ export function UI() {
}
})
+ document.addEventListener("mapSourceChanged", (ev) => {
+ var source = (ev as CustomEvent).detail;
+ if (source !== activeMapSource)
+ setActiveMapSource(source);
+ })
+
+
+ document.addEventListener("configLoaded", (ev) => {
+ let config = getApp().getConfig();
+ var sources = Object.keys(config.mapMirrors).concat(Object.keys(config.mapLayers));
+ setMapSources(sources);
+ setActiveMapSource(sources[0]);
+ })
+
function hideAllMenus() {
setMainMenuVisible(false);
setSpawnMenuVisible(false);
@@ -111,7 +127,9 @@ export function UI() {
drawingMenuVisible: drawingMenuVisible,
optionsMenuVisible: optionsMenuVisible,
mapOptions: mapOptions,
- mapHiddenTypes: mapHiddenTypes
+ mapHiddenTypes: mapHiddenTypes,
+ mapSources: mapSources,
+ activeMapSource: activeMapSource
}}>
setOptionsMenuVisible(false)}
+ options={mapOptions}
/>
diff --git a/frontend/react/src/unit/unit.ts b/frontend/react/src/unit/unit.ts
index 7baa955b..27e13d50 100644
--- a/frontend/react/src/unit/unit.ts
+++ b/frontend/react/src/unit/unit.ts
@@ -5,7 +5,7 @@ import { CustomMarker } from '../map/markers/custommarker';
import { SVGInjector } from '@tanem/svg-injector';
import { UnitDatabase } from './databases/unitdatabase';
import { TargetMarker } from '../map/markers/targetmarker';
-import { DLINK, DataIndexes, GAME_MASTER, HIDE_GROUP_MEMBERS, IDLE, IRST, MOVE_UNIT, OPTIC, RADAR, ROEs, RWR, SHOW_UNIT_CONTACTS, SHOW_UNITS_ENGAGEMENT_RINGS, SHOW_UNIT_PATHS, SHOW_UNIT_TARGETS, VISUAL, emissionsCountermeasures, reactionsToThreat, states, SHOW_UNITS_ACQUISITION_RINGS, HIDE_UNITS_SHORT_RANGE_RINGS, FILL_SELECTED_RING, GROUPING_ZOOM_TRANSITION, MAX_SHOTS_SCATTER, SHOTS_SCATTER_DEGREES, GROUND_UNIT_AIR_DEFENCE_REGEX } from '../constants/constants';
+import { DLINK, DataIndexes, GAME_MASTER, IDLE, IRST, MOVE_UNIT, OPTIC, RADAR, ROEs, RWR, VISUAL, emissionsCountermeasures, reactionsToThreat, states, GROUPING_ZOOM_TRANSITION, MAX_SHOTS_SCATTER, SHOTS_SCATTER_DEGREES, GROUND_UNIT_AIR_DEFENCE_REGEX } from '../constants/constants';
import { DataExtractor } from '../server/dataextractor';
import { groundUnitDatabase } from './databases/groundunitdatabase';
import { navyUnitDatabase } from './databases/navyunitdatabase';
@@ -708,7 +708,7 @@ export abstract class Unit extends CustomMarker {
/* Hide the unit if it does not belong to the commanded coalition and it is not detected by a method that can pinpoint its location (RWR does not count) */
(!this.belongsToCommandedCoalition() && (this.#detectionMethods.length == 0 || (this.#detectionMethods.length == 1 && this.#detectionMethods[0] === RWR))) ||
/* Hide the unit if grouping is activated, the unit is not the group leader, it is not selected, and the zoom is higher than the grouping threshold */
- (getApp().getMap().getOptions()[HIDE_GROUP_MEMBERS] && !this.#isLeader && !this.getSelected() && this.getCategory() == "GroundUnit" && getApp().getMap().getZoom() < GROUPING_ZOOM_TRANSITION &&
+ (getApp().getMap().getOptions().hideGroupMembers && !this.#isLeader && !this.getSelected() && this.getCategory() == "GroundUnit" && getApp().getMap().getZoom() < GROUPING_ZOOM_TRANSITION &&
(this.belongsToCommandedCoalition() || (!this.belongsToCommandedCoalition() && this.#detectionMethods.length == 0))));
/* Force dead units to be hidden */
@@ -1245,7 +1245,7 @@ export abstract class Unit extends CustomMarker {
}
#drawPath() {
- if (this.#activePath != undefined && getApp().getMap().getOptions()[SHOW_UNIT_PATHS]) {
+ if (this.#activePath != undefined && getApp().getMap().getOptions().showUnitPaths) {
var points: LatLng[] = [];
points.push(new LatLng(this.#position.lat, this.#position.lng));
@@ -1289,7 +1289,7 @@ export abstract class Unit extends CustomMarker {
#drawContacts() {
this.#clearContacts();
- if (getApp().getMap().getOptions()[SHOW_UNIT_CONTACTS]) {
+ if (getApp().getMap().getOptions().showUnitContacts) {
for (let index in this.#contacts) {
var contactData = this.#contacts[index];
var contact: Unit | Weapon | null;
@@ -1364,12 +1364,12 @@ export abstract class Unit extends CustomMarker {
if (engagementRange !== this.#engagementCircle.getRadius())
this.#engagementCircle.setRadius(engagementRange);
- this.#engagementCircle.options.fillOpacity = this.getSelected() && getApp().getMap().getOptions()[FILL_SELECTED_RING] ? 0.3 : 0;
+ this.#engagementCircle.options.fillOpacity = this.getSelected() && getApp().getMap().getOptions().fillSelectedRing ? 0.3 : 0;
/* Acquisition circles */
- var shortAcquisitionRangeCheck = (acquisitionRange > nmToM(3) || !getApp().getMap().getOptions()[HIDE_UNITS_SHORT_RANGE_RINGS]);
+ var shortAcquisitionRangeCheck = (acquisitionRange > nmToM(3) || !getApp().getMap().getOptions().hideUnitsShortRangeRings);
- if (getApp().getMap().getOptions()[SHOW_UNITS_ACQUISITION_RINGS] && shortAcquisitionRangeCheck && (this.belongsToCommandedCoalition() || this.getDetectionMethods().some(value => [VISUAL, OPTIC, IRST, RWR].includes(value)))) {
+ if (getApp().getMap().getOptions().showUnitsAcquisitionRings && shortAcquisitionRangeCheck && (this.belongsToCommandedCoalition() || this.getDetectionMethods().some(value => [VISUAL, OPTIC, IRST, RWR].includes(value)))) {
if (!getApp().getMap().hasLayer(this.#acquisitionCircle)) {
this.#acquisitionCircle.addTo(getApp().getMap());
switch (this.getCoalition()) {
@@ -1393,8 +1393,8 @@ export abstract class Unit extends CustomMarker {
}
/* Engagement circles */
- var shortEngagementRangeCheck = (engagementRange > nmToM(3) || !getApp().getMap().getOptions()[HIDE_UNITS_SHORT_RANGE_RINGS]);
- if (getApp().getMap().getOptions()[SHOW_UNITS_ENGAGEMENT_RINGS] && shortEngagementRangeCheck && (this.belongsToCommandedCoalition() || this.getDetectionMethods().some(value => [VISUAL, OPTIC, IRST, RWR].includes(value)))) {
+ var shortEngagementRangeCheck = (engagementRange > nmToM(3) || !getApp().getMap().getOptions().hideUnitsShortRangeRings);
+ if (getApp().getMap().getOptions().showUnitsEngagementRings && shortEngagementRangeCheck && (this.belongsToCommandedCoalition() || this.getDetectionMethods().some(value => [VISUAL, OPTIC, IRST, RWR].includes(value)))) {
if (!getApp().getMap().hasLayer(this.#engagementCircle)) {
this.#engagementCircle.addTo(getApp().getMap());
switch (this.getCoalition()) {
@@ -1428,10 +1428,10 @@ export abstract class Unit extends CustomMarker {
}
#drawTarget() {
- if (this.#targetPosition.lat != 0 && this.#targetPosition.lng != 0 && getApp().getMap().getOptions()[SHOW_UNIT_PATHS]) {
+ if (this.#targetPosition.lat != 0 && this.#targetPosition.lng != 0 && getApp().getMap().getOptions().showUnitPaths) {
this.#drawTargetPosition(this.#targetPosition);
}
- else if (this.#targetID != 0 && getApp().getMap().getOptions()[SHOW_UNIT_TARGETS]) {
+ else if (this.#targetID != 0 && getApp().getMap().getOptions().showUnitTargets) {
const target = getApp().getUnitsManager().getUnitByID(this.#targetID);
if (target && (getApp().getMissionManager().getCommandModeOptions().commandMode == GAME_MASTER || (this.belongsToCommandedCoalition() && getApp().getUnitsManager().getUnitDetectedMethods(target).some(value => [VISUAL, OPTIC, RADAR, IRST, DLINK].includes(value))))) {
this.#drawTargetPosition(target.getPosition());
@@ -1648,7 +1648,7 @@ export class GroundUnit extends Unit {
/* When a unit is a leader of a group, the map is zoomed out and grouping when zoomed out is enabled, check if the unit should be shown as a specific group. This is used to show a SAM battery instead of the group leader */
getDatabaseEntry() {
let unitWhenGrouped: string | undefined | null = null;
- if (!this.getSelected() && this.getIsLeader() && getApp().getMap().getOptions()[HIDE_GROUP_MEMBERS] && getApp().getMap().getZoom() < GROUPING_ZOOM_TRANSITION) {
+ if (!this.getSelected() && this.getIsLeader() && getApp().getMap().getOptions().hideGroupMembers && getApp().getMap().getZoom() < GROUPING_ZOOM_TRANSITION) {
unitWhenGrouped = this.getDatabase()?.getByName(this.getName())?.unitWhenGrouped ?? null;
let member = this.getGroupMembers().reduce((prev: Unit | null, unit: Unit, index: number) => {
if (unit.getDatabaseEntry()?.unitWhenGrouped != undefined)
@@ -1665,7 +1665,7 @@ export class GroundUnit extends Unit {
/* When we zoom past the grouping limit, grouping is enabled and the unit is a leader, we redraw the unit to apply any possible grouped marker */
checkZoomRedraw(): boolean {
- return (this.getIsLeader() && getApp().getMap().getOptions()[HIDE_GROUP_MEMBERS] as boolean &&
+ return (this.getIsLeader() && getApp().getMap().getOptions().hideGroupMembers as boolean &&
(getApp().getMap().getZoom() >= GROUPING_ZOOM_TRANSITION && getApp().getMap().getPreviousZoom() < GROUPING_ZOOM_TRANSITION ||
getApp().getMap().getZoom() < GROUPING_ZOOM_TRANSITION && getApp().getMap().getPreviousZoom() >= GROUPING_ZOOM_TRANSITION))
}
diff --git a/frontend/react/src/unit/unitsmanager.ts b/frontend/react/src/unit/unitsmanager.ts
index 4fcba3b9..136d5c94 100644
--- a/frontend/react/src/unit/unitsmanager.ts
+++ b/frontend/react/src/unit/unitsmanager.ts
@@ -1192,9 +1192,6 @@ export class UnitsManager {
*
*/
copy(units: Unit[] | null = null) {
- //if (!getApp().getContextManager().getCurrentContext().getAllowUnitCopying())
- // return;
-
if (units === null)
units = this.getSelectedUnits();
@@ -1212,9 +1209,6 @@ export class UnitsManager {
* @returns True if units were pasted successfully
*/
paste() {
- //if (!getApp().getContextManager().getCurrentContext().getAllowUnitPasting())
- // return;
-
let spawnPoints = 0;
/* If spawns are restricted, check that the user has the necessary spawn points */