From bd3ac54ff80cafabc84429a003ef4621770644de Mon Sep 17 00:00:00 2001 From: Davide Passoni Date: Thu, 25 Jul 2024 10:23:43 +0200 Subject: [PATCH] Update map.ts --- frontend/react/src/map/map.ts | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/frontend/react/src/map/map.ts b/frontend/react/src/map/map.ts index 9c3018f0..3d115636 100644 --- a/frontend/react/src/map/map.ts +++ b/frontend/react/src/map/map.ts @@ -115,7 +115,7 @@ export class Map extends L.Map { maxBoundsViscosity: 1.0, minZoom: 7, keyboard: true, - keyboardPanDelta: 0 + keyboardPanDelta: 0, }); this.setView([37.23, -115.8], 10); @@ -300,6 +300,16 @@ export class Map extends L.Map { } else if (Object.keys(this.#mapMirrors).includes(layerName)) { let layers: L.TileLayer[] = []; + layers.push( + new L.TileLayer( + "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", + { + minZoom: 1, + maxZoom: 19, + } + ) + ); + /* Load the configuration file */ const mirror = this.#mapMirrors[layerName as any]; const request = new Request(mirror + "/config.json"); @@ -743,7 +753,6 @@ export class Map extends L.Map { /* Still waiting so no doubleclick; do the click action */ if (this.#waitingForDoubleClick) { if (!this.#preventLeftClick) { - /* Execute the short click action */ if (this.#state === IDLE) { this.deselectAllCoalitionAreas(); @@ -828,12 +837,16 @@ export class Map extends L.Map { } #onMouseDown(e: any) { - this.#longPressTimer = window.setTimeout(()=> { + this.#longPressTimer = window.setTimeout(() => { if (!this.#isDragging && !this.#isZooming) if (e.type === "touchstart") - document.dispatchEvent(new CustomEvent("mapForceBoxSelect", {detail: e})); + document.dispatchEvent( + new CustomEvent("mapForceBoxSelect", { detail: e }) + ); else - document.dispatchEvent(new CustomEvent("mapForceBoxSelect", {detail: e.originalEvent})); + document.dispatchEvent( + new CustomEvent("mapForceBoxSelect", { detail: e.originalEvent }) + ); }, 500); } @@ -842,10 +855,7 @@ export class Map extends L.Map { this.#lastMousePosition.y = e.originalEvent.y; this.#lastMouseCoordinates = this.mouseEventToLatLng(e.originalEvent); - if ( - this.#state === COALITIONAREA_DRAW_POLYGON && - e.latlng !== undefined - ) { + if (this.#state === COALITIONAREA_DRAW_POLYGON && e.latlng !== undefined) { /* Update the polygon being drawn with the current position of the mouse cursor */ this.getSelectedCoalitionArea()?.moveActiveVertex(e.latlng); }