From 3d609771dec0919a4d5986eed25649396c647a91 Mon Sep 17 00:00:00 2001 From: ThePetrovich Date: Fri, 27 Jun 2025 21:14:14 +0800 Subject: [PATCH] Map coordinates selection --- src/routes/ControlPanel.svelte | 18 ++++-- src/routes/Toast.svelte | 97 +++++++++++++++++++++++++++++++++ src/routes/map.svelte | 6 +- src/routes/predict/+page.svelte | 57 +++++++++++++++---- static/css/custom.css | 2 +- 5 files changed, 157 insertions(+), 23 deletions(-) create mode 100644 src/routes/Toast.svelte diff --git a/src/routes/ControlPanel.svelte b/src/routes/ControlPanel.svelte index 3081dda..5288255 100644 --- a/src/routes/ControlPanel.svelte +++ b/src/routes/ControlPanel.svelte @@ -20,7 +20,7 @@ let selectedProfile: ProfileName = "Normal"; let startPoint = "Custom"; - export let element: HTMLDivElement | null = null; + let element: HTMLDivElement | null = null; const now = new Date(); let startDate = now.toISOString().split("T")[0]; // YYYY-MM-DD @@ -53,6 +53,10 @@ } }; + export let handleClickSelectOnMap = () => { + console.log("Select on map clicked"); + } + const applyCoordinatesFromInput = () => { const lat = parseFloat(inputLat); const lng = parseFloat(inputLng); @@ -80,8 +84,8 @@ $FlightParametersStore.launch_latitude = lat; $FlightParametersStore.launch_longitude = lng; console.log("Launch position updated:", lat, lng); - inputLat = lat.toString(); - inputLng = lng.toString(); + inputLat = lat.toFixed(6).toString(); + inputLng = lng.toFixed(6).toString(); }; export const getElement = () => { @@ -89,7 +93,11 @@ }; -
+
console.log("Select on map clicked")}>Указать на картеУказать на карте diff --git a/src/routes/Toast.svelte b/src/routes/Toast.svelte new file mode 100644 index 0000000..add2620 --- /dev/null +++ b/src/routes/Toast.svelte @@ -0,0 +1,97 @@ + + + + + +
+ {#each $toasts as toast (toast.id)} + removeToast(toast.id)} + > + removeToast(toast.id)}> + {toast.header} + + + {toast.body} + + + {/each} +
+ + \ No newline at end of file diff --git a/src/routes/map.svelte b/src/routes/map.svelte index c2e964e..8f7db6f 100644 --- a/src/routes/map.svelte +++ b/src/routes/map.svelte @@ -7,8 +7,6 @@ import { distHaversine } from "../lib/mathutil.ts"; import type { PredictionData, TelemetryData } from "../lib/types.ts"; - - /** * @type {'prediction' | 'telemetry'} */ @@ -153,9 +151,7 @@ {mouseLng.toFixed(6)}

-
- -
+ {#if map} {/if} diff --git a/src/routes/predict/+page.svelte b/src/routes/predict/+page.svelte index 7a1f701..54e13d0 100644 --- a/src/routes/predict/+page.svelte +++ b/src/routes/predict/+page.svelte @@ -1,15 +1,17 @@
- - + + + -
\ No newline at end of file + diff --git a/static/css/custom.css b/static/css/custom.css index 13a0399..b9ce25f 100644 --- a/static/css/custom.css +++ b/static/css/custom.css @@ -78,6 +78,6 @@ .panel-container { position: absolute; bottom: 20px; - right: 20px; + left: 20px; z-index: 1000; } \ No newline at end of file