From 21dca2eefbdda8c6369b308860f9a4eea6bf17bd Mon Sep 17 00:00:00 2001 From: David Hochbaum Date: Tue, 24 Dec 2024 14:10:43 -0500 Subject: [PATCH] =?UTF-8?q?Fixed=20zoom=20error=20on=20pages=20which=20inc?= =?UTF-8?q?lude=20a=20=E2=80=9Czoom=20to=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/atlas.client.tsx | 4 ++-- app/extensions/FlyToGeoJsonExtension.ts | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/components/atlas.client.tsx b/app/components/atlas.client.tsx index 9bc4315..7110471 100644 --- a/app/components/atlas.client.tsx +++ b/app/components/atlas.client.tsx @@ -15,8 +15,8 @@ import { } from "./layers"; import type { MapView, MapViewState } from "@deck.gl/core"; -const MAX_ZOOM = 20; -const MIN_ZOOM = 10; +export const MAX_ZOOM = 20; +export const MIN_ZOOM = 10; const INITIAL_VIEW_STATE = { longitude: -74.0008, diff --git a/app/extensions/FlyToGeoJsonExtension.ts b/app/extensions/FlyToGeoJsonExtension.ts index 80d36ac..cefc15e 100644 --- a/app/extensions/FlyToGeoJsonExtension.ts +++ b/app/extensions/FlyToGeoJsonExtension.ts @@ -7,6 +7,7 @@ import { } from "@deck.gl/core"; import { bbox } from "@turf/bbox"; import { Geometry } from "geojson"; +import { MIN_ZOOM, MAX_ZOOM } from "../components/atlas.client"; export class FlyToGeoJsonExtension extends LayerExtension { updateState( @@ -42,6 +43,8 @@ export class FlyToGeoJsonExtension extends LayerExtension { zoom: zoom, transitionDuration: 750, transitionInterpolator: new FlyToInterpolator(), + maxZoom: MAX_ZOOM, + minZoom: MIN_ZOOM, }; deckInstance.props.onViewStateChange({ viewState: newViewState,