Skip to content

Commit

Permalink
Fix demo initialized without url params
Browse files Browse the repository at this point in the history
  • Loading branch information
Trufi committed May 14, 2024
1 parent 3c5b358 commit aab04a1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions demo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit aab04a1

Please sign in to comment.