Skip to content

Commit

Permalink
feat(mapper): add zoom to extent button to map (#1947)
Browse files Browse the repository at this point in the history
* fix(main): shift osmStyle to baselayers constant

* fix(layer-switcher): user added layer vanish issue on switching to initial selected layer issue solve

* feat(crop-free): icon add

* fix(main): zoom to project btn add
  • Loading branch information
NSUWAL123 authored Dec 4, 2024
1 parent 2800144 commit 65842e1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/mapper/src/lib/components/map/main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@
};
}
function zoomToProject() {
const taskBuffer = buffer(taskStore.featcol, 5, { units: 'meters' });
if (taskBuffer && map) {
const taskBbox: [number, number, number, number] = bbox(taskBuffer) as [number, number, number, number];
map?.fitBounds(taskBbox, { duration: 500 });
}
}
onMount(async () => {
// Register pmtiles protocol
if (!maplibre.config.REGISTERED_PROTOCOLS.hasOwnProperty('pmtiles')) {
Expand Down Expand Up @@ -248,6 +256,14 @@
>
</ControlGroup></Control
>
<Control class="flex flex-col gap-y-2" position="top-left">
<ControlGroup>
<ControlButton on:click={zoomToProject}
><hot-icon name="crop-free" class={`!text-[1.2rem] cursor-pointer duration-200 text-black`}
></hot-icon></ControlButton
>
</ControlGroup></Control
>
<Control class="flex flex-col gap-y-2" position="bottom-right">
<LayerSwitcher
{map}
Expand Down
1 change: 1 addition & 0 deletions src/mapper/static/assets/icons/crop-free.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 65842e1

Please sign in to comment.