mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-10-16 04:18:19 +00:00
copy coordinates button for POIs, closes #195
This commit is contained in:
23
website/src/lib/components/gpx-layer/CopyCoordinates.svelte
Normal file
23
website/src/lib/components/gpx-layer/CopyCoordinates.svelte
Normal file
@@ -0,0 +1,23 @@
|
||||
<script lang="ts">
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import { ClipboardCopy } from 'lucide-svelte';
|
||||
import { _ } from 'svelte-i18n';
|
||||
import type { Coordinates } from 'gpx';
|
||||
|
||||
export let coordinates: Coordinates;
|
||||
export let onCopy: () => void = () => {};
|
||||
</script>
|
||||
|
||||
<Button
|
||||
class="w-full px-2 py-1 h-8 justify-start {$$props.class}"
|
||||
variant="outline"
|
||||
on:click={() => {
|
||||
navigator.clipboard.writeText(
|
||||
`${coordinates.lat.toFixed(6)}, ${coordinates.lon.toFixed(6)}`
|
||||
);
|
||||
onCopy();
|
||||
}}
|
||||
>
|
||||
<ClipboardCopy size="16" class="mr-1" />
|
||||
{$_('menu.copy_coordinates')}
|
||||
</Button>
|
Reference in New Issue
Block a user