Skip to content

Commit

Permalink
Add min max zoom options
Browse files Browse the repository at this point in the history
  • Loading branch information
etienneburdet committed Oct 9, 2023
1 parent 36272ee commit d001fc1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/visualizations/src/components/MapPoi/Map.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
$: ({
bbox: _bbox,
zoom,
center: _center,
zoom,
minZoom,
maxZoom,
title,
subtitle,
description,
Expand All @@ -52,6 +54,8 @@
bbox={$bbox}
center={$center}
{zoom}
{minZoom}
{maxZoom}
{title}
{subtitle}
{description}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
// Options
export let bbox: BBox | undefined;
export let zoom: number | undefined;
export let minZoom: number | undefined;
export let maxZoom: number | undefined;
export let center: LngLatLike | undefined;
export let aspectRatio: number;
export let interactive: boolean;
Expand Down Expand Up @@ -53,6 +55,8 @@
bounds: bbox as LngLatBoundsLike,
...getCenterZoomOptions({ zoom, center }),
transformRequest,
minZoom,
maxZoom,
};
map.initialize(style, container, options);
});
Expand Down
2 changes: 2 additions & 0 deletions packages/visualizations/src/components/MapPoi/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export interface PoiMapOptions {
bbox?: BBox;
center?: LngLatLike;
zoom?: number;
minZoom?: number;
maxZoom?: number;
// Aspect ratio used to draw the map. The map will take he width available to it, and decide its height based on that ratio.
aspectRatio?: number;
// Is the map interactive for the user (zoom, move, tooltips...)
Expand Down
4 changes: 4 additions & 0 deletions packages/visualizations/src/components/MapPoi/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ export const getMapOptions = (options: PoiMapOptions) => {
aspectRatio = DEFAULT_ASPECT_RATIO,
bbox,
zoom,
maxZoom,
minZoom,
center,
interactive = true,
title,
Expand All @@ -114,6 +116,8 @@ export const getMapOptions = (options: PoiMapOptions) => {
aspectRatio,
bbox,
zoom,
minZoom,
maxZoom,
center,
interactive,
title,
Expand Down

0 comments on commit d001fc1

Please sign in to comment.