Implement fit-to-track (#43) (#69)

* Implement fit-to-track (#43)

* * Change icon to Maximize
* Use default animation
* Rename feature to "Fly to"
* Move logic to stores so that it can be reused in the main menu (and eventually a keyboard shortcut)

* improve zoom on selected POIs, rework zoom buttons and add shortcut

---------

Co-authored-by: vcoppe <vianney.coppe@gmail.com>
This commit is contained in:
mbof
2024-08-26 05:00:53 -07:00
committed by GitHub
parent 766ebe0275
commit b9ca55c798
4 changed files with 156 additions and 41 deletions

View File

@@ -41,7 +41,8 @@
FileStack,
FileX,
BookOpenText,
ChartArea
ChartArea,
Maximize
} from 'lucide-svelte';
import {
@@ -54,7 +55,8 @@
editMetadata,
editStyle,
exportState,
ExportState
ExportState,
centerMapOnSelection
} from '$lib/stores';
import {
copied,
@@ -247,6 +249,17 @@
{$_('menu.select_all')}
<Shortcut key="A" ctrl={true} />
</Menubar.Item>
<Menubar.Item
on:click={() => {
if ($selection.size > 0) {
centerMapOnSelection();
}
}}
>
<Maximize size="16" class="mr-1" />
{$_('menu.center')}
<Shortcut key="⏎" ctrl={true} />
</Menubar.Item>
{#if $verticalFileView}
<Menubar.Separator />
<Menubar.Item on:click={copySelection} disabled={$selection.size === 0}>
@@ -536,6 +549,10 @@
dbUtils.setHiddenToSelection(true);
}
e.preventDefault();
} else if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
if ($selection.size > 0) {
centerMapOnSelection();
}
} else if (e.key === 'F1') {
switchBasemaps();
e.preventDefault();