Prevent propagation on panel
This commit is contained in:
parent
52558ed3b2
commit
eb29cdc585
2 changed files with 194 additions and 172 deletions
|
|
@ -14,12 +14,14 @@
|
||||||
import { getForecast } from "$lib/prediction";
|
import { getForecast } from "$lib/prediction";
|
||||||
import type { FlightParameters, ProfileName } from "$lib/types";
|
import type { FlightParameters, ProfileName } from "$lib/types";
|
||||||
import { PROFILE_MAP } from "$lib/types";
|
import { PROFILE_MAP } from "$lib/types";
|
||||||
import { FlightParametersStore, writeLocalStorage } from '$lib/stores';
|
import { FlightParametersStore, writeLocalStorage } from "$lib/stores";
|
||||||
|
|
||||||
let isCollapsed = false;
|
let isCollapsed = false;
|
||||||
let selectedProfile: ProfileName = "Normal";
|
let selectedProfile: ProfileName = "Normal";
|
||||||
let startPoint = "Custom";
|
let startPoint = "Custom";
|
||||||
|
|
||||||
|
export let element: HTMLDivElement | null = null;
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
let startDate = now.toISOString().split("T")[0]; // YYYY-MM-DD
|
let startDate = now.toISOString().split("T")[0]; // YYYY-MM-DD
|
||||||
let startTime = now.toISOString().split("T")[1].split(".")[0]; // HH:MM:SS
|
let startTime = now.toISOString().split("T")[1].split(".")[0]; // HH:MM:SS
|
||||||
|
|
@ -27,7 +29,10 @@
|
||||||
let inputLat = $FlightParametersStore.launch_latitude.toString();
|
let inputLat = $FlightParametersStore.launch_latitude.toString();
|
||||||
let inputLng = $FlightParametersStore.launch_longitude.toString();
|
let inputLng = $FlightParametersStore.launch_longitude.toString();
|
||||||
|
|
||||||
$: $FlightParametersStore.profile = PROFILE_MAP[selectedProfile];
|
$: $FlightParametersStore = {
|
||||||
|
...$FlightParametersStore,
|
||||||
|
profile: PROFILE_MAP[selectedProfile],
|
||||||
|
};
|
||||||
|
|
||||||
const handleGetPrediction = async () => {
|
const handleGetPrediction = async () => {
|
||||||
console.log("Fetching prediction with parameters:", $FlightParametersStore);
|
console.log("Fetching prediction with parameters:", $FlightParametersStore);
|
||||||
|
|
@ -55,7 +60,11 @@
|
||||||
if (!isNaN(lat) && !isNaN(lng)) {
|
if (!isNaN(lat) && !isNaN(lng)) {
|
||||||
$FlightParametersStore.launch_latitude = lat;
|
$FlightParametersStore.launch_latitude = lat;
|
||||||
$FlightParametersStore.launch_longitude = lng;
|
$FlightParametersStore.launch_longitude = lng;
|
||||||
console.log("Updated position:", $FlightParametersStore.launch_latitude, $FlightParametersStore.launch_longitude);
|
console.log(
|
||||||
|
"Updated position:",
|
||||||
|
$FlightParametersStore.launch_latitude,
|
||||||
|
$FlightParametersStore.launch_longitude,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
console.error("Invalid coordinate input");
|
console.error("Invalid coordinate input");
|
||||||
// TODO: Show a validation error to the user.
|
// TODO: Show a validation error to the user.
|
||||||
|
|
@ -74,12 +83,14 @@
|
||||||
inputLat = lat.toString();
|
inputLat = lat.toString();
|
||||||
inputLng = lng.toString();
|
inputLng = lng.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getElement = () => {
|
||||||
|
return element;
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Card
|
<div bind:this={element} style="width: 23rem; max-height: 80vh; overflow-y: auto; z-index: 1000;" class="position-absolute shadow-lg bottom-0 end-0 m-3">
|
||||||
class="shadow-lg position-absolute bottom-0 end-0 m-3"
|
<Card>
|
||||||
style="width: 23rem; max-height: 80vh; overflow-y: auto; z-index: 1000;"
|
|
||||||
>
|
|
||||||
<CardHeader
|
<CardHeader
|
||||||
class="bg-primary text-white d-flex justify-content-between align-items-center card-header"
|
class="bg-primary text-white d-flex justify-content-between align-items-center card-header"
|
||||||
style="cursor:pointer;"
|
style="cursor:pointer;"
|
||||||
|
|
@ -133,7 +144,12 @@
|
||||||
<option value={profileName}>{profileName}</option>
|
<option value={profileName}>{profileName}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</Input>
|
</Input>
|
||||||
<Button color="secondary" size="sm" title="Edit profile" disabled={selectedProfile !== "Custom"}>
|
<Button
|
||||||
|
color="secondary"
|
||||||
|
size="sm"
|
||||||
|
title="Edit profile"
|
||||||
|
disabled={selectedProfile !== "Custom"}
|
||||||
|
>
|
||||||
<span>Редакт.</span>
|
<span>Редакт.</span>
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
|
@ -269,3 +285,4 @@
|
||||||
</CardBody>
|
</CardBody>
|
||||||
{/if}
|
{/if}
|
||||||
</Card>
|
</Card>
|
||||||
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,14 @@
|
||||||
map?.clearMapLayers();
|
map?.clearMapLayers();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
console.log('ControlPanel mounted');
|
||||||
|
console.log(panel);
|
||||||
|
|
||||||
L.DomEvent.disableClickPropagation(panel?.$element);
|
if (panel) {
|
||||||
L.DomEvent.disableScrollPropagation(panel?.$element);
|
let element = panel.getElement();
|
||||||
|
L.DomEvent.disableClickPropagation(element);
|
||||||
|
L.DomEvent.disableScrollPropagation(element);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue