fix some typescript errors

This commit is contained in:
vcoppe
2025-11-10 13:11:44 +01:00
parent bce7b5984f
commit 16023b0688
13 changed files with 73 additions and 44 deletions

View File

@@ -156,7 +156,7 @@ export class GPXLayer {
}
try {
let source = _map.getSource(this.fileId);
let source = _map.getSource(this.fileId) as mapboxgl.GeoJSONSource | undefined;
if (source) {
source.setData(this.getGeoJSON());
} else {

View File

@@ -227,8 +227,9 @@
</CustomControl>
<svelte:window
on:click={(e) => {
if (open && !cancelEvents && !container.contains(e.target)) {
on:click={(e: MouseEvent) => {
const target = e.target as Node | null;
if (open && !cancelEvents && target && container && !container.contains(target)) {
closeLayerControl();
}
}}

View File

@@ -5,7 +5,7 @@
import { i18n } from '$lib/i18n.svelte';
import { ScrollArea } from '$lib/components/ui/scroll-area/index.js';
import type { WaypointType } from 'gpx';
import type { PopupItem } from '$lib/components/map/map';
import type { PopupItem } from '$lib/components/map/map-popup';
import { fileActions } from '$lib/logic/file-actions';
import { selection } from '$lib/logic/selection';

View File

@@ -74,7 +74,7 @@ export class OverpassLayer {
let d = get(data);
try {
let source = this.map.getSource('overpass');
let source = this.map.getSource('overpass') as mapboxgl.GeoJSONSource | undefined;
if (source) {
source.setData(d);
} else {
@@ -284,9 +284,9 @@ function getQuery(query: string) {
}
function getQueryItem(tags: Record<string, string | boolean | string[]>) {
let arrayEntry = Object.entries(tags).find(([_, value]) => Array.isArray(value));
let arrayEntry = Object.values(tags).find((value) => Array.isArray(value));
if (arrayEntry !== undefined) {
return arrayEntry[1]
return arrayEntry
.map(
(val) =>
`nwr${Object.entries(tags)

View File

@@ -135,12 +135,19 @@ export class MapillaryLayer {
}
onMouseEnter(e: mapboxgl.MapMouseEvent) {
this.active = true;
if (
e.features &&
e.features.length > 0 &&
e.features[0].properties &&
e.features[0].properties.id
) {
this.active = true;
this.viewer.resize();
this.viewer.moveTo(e.features[0].properties.id);
this.viewer.resize();
this.viewer.moveTo(e.features[0].properties.id);
mapCursor.notify(MapCursorState.MAPILLARY_HOVER, true);
mapCursor.notify(MapCursorState.MAPILLARY_HOVER, true);
}
}
onMouseLeave() {