fix login & add sveltestrap

This commit is contained in:
ThePetrovich 2025-06-26 19:15:33 +08:00
parent a822fb1e36
commit 527d4417ff
15 changed files with 373 additions and 191 deletions

View file

@ -1,6 +1,9 @@
<script>
<script lang="ts">
import { onMount } from 'svelte';
import * as L from 'leaflet';
import type { Map as LeafletMap } from 'leaflet';
import type { Marker } from 'leaflet';
import type { LatLng } from 'leaflet';
import 'leaflet/dist/leaflet.css';
import VelocityLayer from './velocity.svelte';
import { distHaversine } from '../lib/mathutil.ts';
@ -8,10 +11,7 @@
import { latestPredictionParsed } from '../lib/prediction.ts';
import { latestTelemetryParsed } from '../lib/telemetry.ts';
/**
* @type {L.Map}
*/
let map;
let map: typeof LeafletMap;
let mouseLat = 0;
let mouseLng = 0;
let inputLat = '56.3576';
@ -26,10 +26,7 @@
},
data: null, // здесь будут ваши данные
};
/**
* @type {null}
*/
let marker = null;
let marker: typeof Marker | null = null;
export { mouseLat, mouseLng, inputLat, inputLng, updateMapPosition };
@ -78,7 +75,7 @@
const response = await fetch('src/routes/testVelo.json');
velocityOptions.data = await response.json();
map.on('mousemove', (e) => {
map.on('mousemove', (e: any) => {
mouseLat = e.latlng.lat.toFixed(6);
mouseLng = e.latlng.lng.toFixed(6);
});
@ -97,12 +94,12 @@
});
});
const plotPrediction = (prediction) => {
const plotPrediction = (prediction: any) => {
console.log("Flight data parsed, creating map plot...");
// Clear existing map items
if (marker) {
map.eachLayer((layer) => {
map.eachLayer((layer: any) => {
if (layer instanceof L.Marker || layer instanceof L.Polyline) {
map.removeLayer(layer);
}
@ -163,12 +160,12 @@
map.setView(launch.latlng, 8);
};
const plotTelemetryTrack = (telemetry) => {
const plotTelemetryTrack = (telemetry: any) => {
console.log("Telemetry data parsed, creating map plot...");
// Clear existing map items
if (marker) {
map.eachLayer((layer) => {
map.eachLayer((layer: any) => {
if (layer instanceof L.Marker || layer instanceof L.Polyline) {
map.removeLayer(layer);
}
@ -203,7 +200,7 @@
// }
// Add telemetry markers to the map
telemetry.datapoints.forEach((point) => {
telemetry.datapoints.forEach((point: any) => {
const telemetryMarker = L.marker([point.latitude, point.longitude], {
title: `Telemetry (${point.latitude.toFixed(4)}, ${point.longitude.toFixed(4)}) at ${point.datetime}`,
icon: telemetryIcon,