mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2026-11-01 12:17:18 +00:00
fix linting issues
This commit is contained in:
1 parent
fbfdc1933c
commit
957f0c35ec
10 files changed
+30
-31
No files matched your search
@@ -9,7 +9,7 @@
|
|||||||
}: {
|
}: {
|
||||||
iconOnly?: boolean;
|
iconOnly?: boolean;
|
||||||
company?: 'gpx.studio' | 'github' | 'crowdin' | 'facebook' | 'reddit';
|
company?: 'gpx.studio' | 'github' | 'crowdin' | 'facebook' | 'reddit';
|
||||||
[key: string]: any;
|
[key: string]: unknown;
|
||||||
} = $props();
|
} = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -66,9 +66,9 @@ export class GPXLayer {
|
|||||||
unsubscribe: (() => void)[] = [];
|
unsubscribe: (() => void)[] = [];
|
||||||
|
|
||||||
updateBinded: () => void = this.update.bind(this);
|
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);
|
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);
|
layerOnClickBinded: (e: MapLayerMouseEvent) => void = this.layerOnClick.bind(this);
|
||||||
layerOnContextMenuBinded: (e: MapLayerMouseEvent) => void = this.layerOnContextMenu.bind(this);
|
layerOnContextMenuBinded: (e: MapLayerMouseEvent) => void = this.layerOnContextMenu.bind(this);
|
||||||
waypointLayerOnMouseEnterBinded: (e: MapLayerMouseEvent) => void =
|
waypointLayerOnMouseEnterBinded: (e: MapLayerMouseEvent) => void =
|
||||||
@@ -386,10 +386,10 @@ export class GPXLayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
layerOnMouseEnter(e: any) {
|
layerOnMouseEnter(e: MapLayerMouseEvent) {
|
||||||
if (
|
if (
|
||||||
get(currentTool) === Tool.SCISSORS &&
|
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);
|
mapCursor.notify(MapCursorState.SCISSORS, true);
|
||||||
} else {
|
} else {
|
||||||
@@ -402,9 +402,9 @@ export class GPXLayer {
|
|||||||
mapCursor.notify(MapCursorState.LAYER_HOVER, false);
|
mapCursor.notify(MapCursorState.LAYER_HOVER, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
async layerOnMouseMove(e: any) {
|
async layerOnMouseMove(e: MapLayerMouseEvent) {
|
||||||
if (e.originalEvent.shiftKey) {
|
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 lngLat = { lng: e.lngLat.lng, lat: e.lngLat.lat };
|
||||||
const index = closestPointIndex(await engine.segmentCoordinates(segmentId), lngLat);
|
const index = closestPointIndex(await engine.segmentCoordinates(segmentId), lngLat);
|
||||||
const trackpoint =
|
const trackpoint =
|
||||||
@@ -469,7 +469,7 @@ export class GPXLayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
layerOnContextMenu(e: any) {
|
layerOnContextMenu(e: MapLayerMouseEvent) {
|
||||||
if (e.originalEvent.ctrlKey) {
|
if (e.originalEvent.ctrlKey) {
|
||||||
this.layerOnClick(e);
|
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)) {
|
if (Object.hasOwn(node, id)) {
|
||||||
delete node[id];
|
delete node[id];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { get, writable } from 'svelte/store';
|
|||||||
import { overpassQueryData } from '$lib/data/layers';
|
import { overpassQueryData } from '$lib/data/layers';
|
||||||
import { MapPopup } from '$lib/components/map/map-popup';
|
import { MapPopup } from '$lib/components/map/map-popup';
|
||||||
import { settings } from '$lib/state/settings';
|
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 { ANCHOR_LAYER_KEY } from '$lib/components/map/style';
|
||||||
import type { MapLayerEventManager } from '$lib/components/map/map-layer-event-manager';
|
import type { MapLayerEventManager } from '$lib/components/map/map-layer-event-manager';
|
||||||
import { loadSVGIcon } from '$lib/utils';
|
import { loadSVGIcon } from '$lib/utils';
|
||||||
@@ -140,12 +140,12 @@ export class OverpassLayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onHover(e: any) {
|
onHover(e: MapLayerMouseEvent) {
|
||||||
this.popup.setItem({
|
this.popup.setItem({
|
||||||
kind: 'overpass',
|
kind: 'overpass',
|
||||||
item: {
|
item: {
|
||||||
...e.features[0].properties,
|
...e.features![0].properties,
|
||||||
sym: overpassQueryData[e.features[0].properties.query].symbol ?? '',
|
sym: overpassQueryData[e.features![0].properties.query].symbol ?? '',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
import { getURLForLanguage } from '$lib/utils';
|
import { getURLForLanguage } from '$lib/utils';
|
||||||
import { Trash2 } from '@lucide/svelte';
|
import { Trash2 } from '@lucide/svelte';
|
||||||
import { map } from '$lib/components/map/map';
|
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 { engine } from '$lib/engine';
|
||||||
import { mapCursor, MapCursorState } from '$lib/state/map-cursor';
|
import { mapCursor, MapCursorState } from '$lib/state/map-cursor';
|
||||||
import { ANCHOR_LAYER_KEY } from '$lib/components/map/style';
|
import { ANCHOR_LAYER_KEY } from '$lib/components/map/style';
|
||||||
@@ -81,12 +81,12 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
let mousedown = false;
|
let mousedown = false;
|
||||||
function onMouseDown(e: any) {
|
function onMouseDown(e: MapMouseEvent | MapTouchEvent) {
|
||||||
mousedown = true;
|
mousedown = true;
|
||||||
rectangleCoordinates = [e.lngLat, e.lngLat];
|
rectangleCoordinates = [e.lngLat, e.lngLat];
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMouseMove(e: any) {
|
function onMouseMove(e: MapMouseEvent | MapTouchEvent) {
|
||||||
if (mousedown) {
|
if (mousedown) {
|
||||||
rectangleCoordinates[1] = e.lngLat;
|
rectangleCoordinates[1] = e.lngLat;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<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 * as Select from '$lib/components/ui/select';
|
||||||
import { Switch } from '$lib/components/ui/switch';
|
import { Switch } from '$lib/components/ui/switch';
|
||||||
import { Label } from '$lib/components/ui/label/index.js';
|
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
|
// the tool works on files, routes, tracks and segments, not on waypoints
|
||||||
let validSelection = $derived(coversSegments($selection));
|
let validSelection = $derived(coversSegments($selection));
|
||||||
|
|
||||||
function createFileWithPoint(e: any) {
|
function createFileWithPoint(e: MapMouseEvent) {
|
||||||
if ($selection.type === 'empty') {
|
if ($selection.type === 'empty') {
|
||||||
// the engine selects the new file, which starts with the trackpoint: one undo step
|
// 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 });
|
engine.newFile(newFileName(), { lng: e.lngLat.lng, lat: e.lngLat.lat });
|
||||||
|
|||||||
@@ -556,8 +556,9 @@ export class RoutingControls {
|
|||||||
let response;
|
let response;
|
||||||
try {
|
try {
|
||||||
response = await route(targets);
|
response = await route(targets);
|
||||||
} catch (e: any) {
|
} catch (e) {
|
||||||
toast.error(i18n._(e.message, e.message));
|
const message = e instanceof Error ? e.message : String(e);
|
||||||
|
toast.error(i18n._(message, message));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,7 +803,7 @@ export class RoutingControls {
|
|||||||
this.moveAnchorFeature(this.anchorWithId(this.anchors.length)!, position);
|
this.moveAnchorFeature(this.anchorWithId(this.anchors.length)!, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
temporaryAnchorCloseToOtherAnchor(e: any) {
|
temporaryAnchorCloseToOtherAnchor(e: MapMouseEvent) {
|
||||||
const map_ = get(map);
|
const map_ = get(map);
|
||||||
if (!map_) {
|
if (!map_) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -29,9 +29,9 @@ export class SplitControls {
|
|||||||
selection: Selection = { type: 'empty' };
|
selection: Selection = { type: 'empty' };
|
||||||
statistics: SelectionStatistics | undefined = undefined;
|
statistics: SelectionStatistics | undefined = undefined;
|
||||||
|
|
||||||
layerOnMouseEnterBinded: (e: any) => void = this.layerOnMouseEnter.bind(this);
|
layerOnMouseEnterBinded: () => void = this.layerOnMouseEnter.bind(this);
|
||||||
layerOnMouseLeaveBinded: () => void = this.layerOnMouseLeave.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) {
|
constructor(map: Map, layerEventManager: MapLayerEventManager) {
|
||||||
this.map = map;
|
this.map = map;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
import { selectedWaypoint } from './waypoint';
|
import { selectedWaypoint } from './waypoint';
|
||||||
import { map } from '$lib/components/map/map';
|
import { map } from '$lib/components/map/map';
|
||||||
import { mapCursor, MapCursorState } from '$lib/state/map-cursor';
|
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';
|
import { getSvgForSymbol } from '$lib/components/map/gpx-layer/gpx-layer';
|
||||||
|
|
||||||
let props: {
|
let props: {
|
||||||
@@ -108,7 +108,7 @@
|
|||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setCoordinates(e: any) {
|
function setCoordinates(e: MapMouseEvent) {
|
||||||
if (
|
if (
|
||||||
$map?.queryRenderedFeatures(e.point, {
|
$map?.queryRenderedFeatures(e.point, {
|
||||||
layers: $map.getLayersOrder().filter((layerId) => layerId.endsWith('-waypoints')),
|
layers: $map.getLayersOrder().filter((layerId) => layerId.endsWith('-waypoints')),
|
||||||
@@ -117,8 +117,8 @@
|
|||||||
// Clicked on a waypoint, ignoring
|
// Clicked on a waypoint, ignoring
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
latitude = e.lngLat.lat.toFixed(6);
|
latitude = parseFloat(e.lngLat.lat.toFixed(6));
|
||||||
longitude = e.lngLat.lng.toFixed(6);
|
longitude = parseFloat(e.lngLat.lng.toFixed(6));
|
||||||
}
|
}
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
|
|||||||
@@ -165,16 +165,14 @@ export const settings = {
|
|||||||
),
|
),
|
||||||
/** Takes the saved values (see `Engine.openStorage`). */
|
/** Takes the saved values (see `Engine.openStorage`). */
|
||||||
connect(stored: StoredSettings) {
|
connect(stored: StoredSettings) {
|
||||||
for (const key in settings) {
|
for (const setting of Object.values(settings)) {
|
||||||
const setting = (settings as any)[key];
|
|
||||||
if (setting instanceof Setting || setting instanceof SettingInitOnFirstRead) {
|
if (setting instanceof Setting || setting instanceof SettingInitOnFirstRead) {
|
||||||
setting.connect(stored);
|
setting.connect(stored);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
initialize() {
|
initialize() {
|
||||||
for (const key in settings) {
|
for (const setting of Object.values(settings)) {
|
||||||
const setting = (settings as any)[key];
|
|
||||||
if (setting instanceof SettingInitOnFirstRead) {
|
if (setting instanceof SettingInitOnFirstRead) {
|
||||||
setting.initialize();
|
setting.initialize();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user