From aab04a1011c44bc46511251a8190e568d42a8398 Mon Sep 17 00:00:00 2001 From: Mstislav Zhivodkov Date: Tue, 14 May 2024 19:47:58 +0100 Subject: [PATCH] Fix demo initialized without url params --- demo/index.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/demo/index.ts b/demo/index.ts index cda1255..35b29fe 100644 --- a/demo/index.ts +++ b/demo/index.ts @@ -109,10 +109,18 @@ const updateUrl = throttle(() => { function restoreFromUrl() { const query = parseQuery(); - map.setCenter([query.lng, query.lat], { animate: false }); - map.setZoom(query.zoom, { animate: false }); - map.setRotation(query.rotation, { animate: false }); - map.setPitch(query.pitch, { animate: false }); + if (query.lng !== undefined && query.lat !== undefined) { + map.setCenter([query.lng, query.lat], { animate: false }); + } + if (query.zoom !== undefined) { + map.setZoom(query.zoom, { animate: false }); + } + if (query.rotation !== undefined) { + map.setRotation(query.rotation, { animate: false }); + } + if (query.pitch !== undefined) { + map.setPitch(query.pitch, { animate: false }); + } for (const key in heatOptions) { if (query[key] !== undefined && !Number.isNaN(query[key])) { if (key === 'adaptiveViewportPallete') {