Simplify maps loading

This commit is contained in:
Eugene Burmakin
2025-02-15 18:16:48 +01:00
parent 62f4ec4910
commit fb5086e97e
3 changed files with 5 additions and 13 deletions
+2 -10
View File
@@ -20,7 +20,7 @@ import "leaflet-draw";
import { initializeFogCanvas, drawFogCanvas, createFogOverlay } from "../maps/fog_of_war";
import { TileMonitor } from "../maps/tile_monitor";
import BaseController from "./base_controller";
import { createMapLayer, createAllMapLayers } from "../maps/layers";
import { createAllMapLayers } from "../maps/layers";
export default class extends BaseController {
static targets = ["container"];
@@ -393,15 +393,7 @@ export default class extends BaseController {
baseMaps() {
let selectedLayerName = this.userSettings.preferred_map_layer || "OpenStreetMap";
let maps; // Declare the variable first
if (this.selfHostedValue) {
maps = createAllMapLayers(this.map, selectedLayerName);
} else {
maps = {
OpenStreetMap: createMapLayer(this.map, selectedLayerName, "OpenStreetMap")
};
}
let maps; createAllMapLayers(this.map, selectedLayerName);
// Add custom map if it exists in settings
if (this.userSettings.maps && this.userSettings.maps.url) {
+1 -2
View File
@@ -1,6 +1,5 @@
// Yeah I know it should be DRY but this is me doing a KISS at 21:00 on a Sunday night
// Import the maps configuration
// In non-self-hosted mode, we need to mount external maps_config.js to the container
import { mapsConfig } from './maps_config';
export function createMapLayer(map, selectedLayerName, layerKey) {