fix linting issues

This commit is contained in:
vcoppe committed 2026-10-31 13:06:44 +01:00
1 parent fbfdc1933c
commit 957f0c35ec
10 files changed
+30 -31

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@
}: {
iconOnly?: boolean;
company?: 'gpx.studio' | 'github' | 'crowdin' | 'facebook' | 'reddit';
[key: string]: any;
[key: string]: unknown;
} = $props();
</script>
@@ -66,9 +66,9 @@ export class GPXLayer {
unsubscribe: (() => void)[] = [];
updateBinded: () => void = this.update.bind(this);
layerOnMouseEnterBinded: (e: any) => void = this.layerOnMouseEnter.bind(this);
layerOnMouseEnterBinded: (e: MapLayerMouseEvent) => void = this.layerOnMouseEnter.bind(this);
layerOnMouseLeaveBinded: () => void = this.layerOnMouseLeave.bind(this);
layerOnMouseMoveBinded: (e: any) => void = this.layerOnMouseMove.bind(this);
layerOnMouseMoveBinded: (e: MapLayerMouseEvent) => void = this.layerOnMouseMove.bind(this);
layerOnClickBinded: (e: MapLayerMouseEvent) => void = this.layerOnClick.bind(this);
layerOnContextMenuBinded: (e: MapLayerMouseEvent) => void = this.layerOnContextMenu.bind(this);
waypointLayerOnMouseEnterBinded: (e: MapLayerMouseEvent) => void =
@@ -386,10 +386,10 @@ export class GPXLayer {
}
}
layerOnMouseEnter(e: any) {
layerOnMouseEnter(e: MapLayerMouseEvent) {
if (
get(currentTool) === Tool.SCISSORS &&
isCovered(this.selectionState, this.segmentNode(e.features[0].properties))
isCovered(this.selectionState, this.segmentNode(e.features![0].properties))
) {
mapCursor.notify(MapCursorState.SCISSORS, true);
} else {
@@ -402,9 +402,9 @@ export class GPXLayer {
mapCursor.notify(MapCursorState.LAYER_HOVER, false);
}
async layerOnMouseMove(e: any) {
async layerOnMouseMove(e: MapLayerMouseEvent) {
if (e.originalEvent.shiftKey) {
const { segmentId } = e.features[0].properties;
const { segmentId } = e.features![0].properties;
const lngLat = { lng: e.lngLat.lng, lat: e.lngLat.lat };
const index = closestPointIndex(await engine.segmentCoordinates(segmentId), lngLat);
const trackpoint =
@@ -469,7 +469,7 @@ export class GPXLayer {
}
}
layerOnContextMenu(e: any) {
layerOnContextMenu(e: MapLayerMouseEvent) {
if (e.originalEvent.ctrlKey) {
this.layerOnClick(e);
}
@@ -182,7 +182,7 @@
}
}
function tryDeleteLayer(node: any, id: string): any {
function tryDeleteLayer<T>(node: Record<string, T>, id: string): Record<string, T> {
if (Object.hasOwn(node, id)) {
delete node[id];
}
@@ -4,7 +4,7 @@ import { get, writable } from 'svelte/store';
import { overpassQueryData } from '$lib/data/layers';
import { MapPopup } from '$lib/components/map/map-popup';
import { settings } from '$lib/state/settings';
import type { GeoJSONSource, Map as MapLibreMap } from 'maplibre-gl';
import type { GeoJSONSource, MapLayerMouseEvent, Map as MapLibreMap } from 'maplibre-gl';
import { ANCHOR_LAYER_KEY } from '$lib/components/map/style';
import type { MapLayerEventManager } from '$lib/components/map/map-layer-event-manager';
import { loadSVGIcon } from '$lib/utils';
@@ -140,12 +140,12 @@ export class OverpassLayer {
}
}
onHover(e: any) {
onHover(e: MapLayerMouseEvent) {
this.popup.setItem({
kind: 'overpass',
item: {
...e.features[0].properties,
sym: overpassQueryData[e.features[0].properties.query].symbol ?? '',
...e.features![0].properties,
sym: overpassQueryData[e.features![0].properties.query].symbol ?? '',
},
});
}
@@ -16,7 +16,7 @@
import { getURLForLanguage } from '$lib/utils';
import { Trash2 } from '@lucide/svelte';
import { map } from '$lib/components/map/map';
import type { GeoJSONSource, LngLat } from 'maplibre-gl';
import type { GeoJSONSource, LngLat, MapMouseEvent, MapTouchEvent } from 'maplibre-gl';
import { engine } from '$lib/engine';
import { mapCursor, MapCursorState } from '$lib/state/map-cursor';
import { ANCHOR_LAYER_KEY } from '$lib/components/map/style';
@@ -81,12 +81,12 @@
});
let mousedown = false;
function onMouseDown(e: any) {
function onMouseDown(e: MapMouseEvent | MapTouchEvent) {
mousedown = true;
rectangleCoordinates = [e.lngLat, e.lngLat];
}
function onMouseMove(e: any) {
function onMouseMove(e: MapMouseEvent | MapTouchEvent) {
if (mousedown) {
rectangleCoordinates[1] = e.lngLat;
}
@@ -1,5 +1,5 @@
<script lang="ts">
import type { Popup } from 'maplibre-gl';
import type { MapMouseEvent, Popup } from 'maplibre-gl';
import * as Select from '$lib/components/ui/select';
import { Switch } from '$lib/components/ui/switch';
import { Label } from '$lib/components/ui/label/index.js';
@@ -58,7 +58,7 @@
// the tool works on files, routes, tracks and segments, not on waypoints
let validSelection = $derived(coversSegments($selection));
function createFileWithPoint(e: any) {
function createFileWithPoint(e: MapMouseEvent) {
if ($selection.type === 'empty') {
// the engine selects the new file, which starts with the trackpoint: one undo step
engine.newFile(newFileName(), { lng: e.lngLat.lng, lat: e.lngLat.lat });
@@ -556,8 +556,9 @@ export class RoutingControls {
let response;
try {
response = await route(targets);
} catch (e: any) {
toast.error(i18n._(e.message, e.message));
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
toast.error(i18n._(message, message));
return false;
}
@@ -802,7 +803,7 @@ export class RoutingControls {
this.moveAnchorFeature(this.anchorWithId(this.anchors.length)!, position);
}
temporaryAnchorCloseToOtherAnchor(e: any) {
temporaryAnchorCloseToOtherAnchor(e: MapMouseEvent) {
const map_ = get(map);
if (!map_) {
return false;
@@ -29,9 +29,9 @@ export class SplitControls {
selection: Selection = { type: 'empty' };
statistics: SelectionStatistics | undefined = undefined;
layerOnMouseEnterBinded: (e: any) => void = this.layerOnMouseEnter.bind(this);
layerOnMouseEnterBinded: () => void = this.layerOnMouseEnter.bind(this);
layerOnMouseLeaveBinded: () => void = this.layerOnMouseLeave.bind(this);
layerOnClickBinded: (e: any) => void = this.layerOnClick.bind(this);
layerOnClickBinded: (e: MapLayerMouseEvent) => void = this.layerOnClick.bind(this);
constructor(map: Map, layerEventManager: MapLayerEventManager) {
this.map = map;
@@ -16,7 +16,7 @@
import { selectedWaypoint } from './waypoint';
import { map } from '$lib/components/map/map';
import { mapCursor, MapCursorState } from '$lib/state/map-cursor';
import { Marker } from 'maplibre-gl';
import { Marker, type MapMouseEvent } from 'maplibre-gl';
import { getSvgForSymbol } from '$lib/components/map/gpx-layer/gpx-layer';
let props: {
@@ -108,7 +108,7 @@
reset();
}
function setCoordinates(e: any) {
function setCoordinates(e: MapMouseEvent) {
if (
$map?.queryRenderedFeatures(e.point, {
layers: $map.getLayersOrder().filter((layerId) => layerId.endsWith('-waypoints')),
@@ -117,8 +117,8 @@
// Clicked on a waypoint, ignoring
return;
}
latitude = e.lngLat.lat.toFixed(6);
longitude = e.lngLat.lng.toFixed(6);
latitude = parseFloat(e.lngLat.lat.toFixed(6));
longitude = parseFloat(e.lngLat.lng.toFixed(6));
}
$effect(() => {