Skip to content

Commit

Permalink
Trying to shut off bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
sdl60660 committed Jun 1, 2022
1 parent dac4887 commit 21dd3ab
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions src/components/Map.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
let container;
let map;
let mapBounds = bounds;
// let mapBounds = bounds;
let geocoder = null;
let runSettings = {};
Expand Down Expand Up @@ -131,7 +131,7 @@
center: startingSearch.lngLat,
});
}
mapBounds = map.getBounds();
// mapBounds = map.getBounds();
// map.dragRotate.disable();
// map.touchZoomRotate.disableRotation();
Expand Down Expand Up @@ -247,21 +247,21 @@
return;
}
if (!mapBounds.contains(e.lngLat)) {
map.flyTo({
center: e.lngLat,
speed: 0.9,
zoom: 4,
});
map.once("moveend", () => {
setTimeout(() => {
initializeData({ map, e });
}, 300);
});
} else {
// if (!mapBounds.contains(e.lngLat)) {
// map.flyTo({
// center: e.lngLat,
// speed: 0.9,
// zoom: 4,
// });
// map.once("moveend", () => {
// setTimeout(() => {
// initializeData({ map, e });
// }, 300);
// });
// } else {
initializeData({ map, e });
}
// }
};
const initializeData = async ({ map, e }) => {
Expand Down Expand Up @@ -1082,9 +1082,9 @@
clearRiverLines({ map, sourceID: "highlighted-section" });
};
const handleResize = () => {
mapBounds = map.getBounds();
};
// const handleResize = () => {
// mapBounds = map.getBounds();
// };
const exitFunction = () => {
aborted = true;
Expand Down Expand Up @@ -1161,17 +1161,20 @@
}
}
$: coordinates.update(() => {
if (mapBounds._sw) {
return [
[mapBounds._sw.lat, mapBounds._ne.lat],
[mapBounds._sw.lng, mapBounds._ne.lng],
];
}
});
// $: coordinates.update(() => {
// console.log(mapBounds)
// if (mapBounds._sw) {
// return [
// [mapBounds._sw.lat, mapBounds._ne.lat],
// [mapBounds._sw.lng, mapBounds._ne.lng],
// ];
// }
// });
</script>

<svelte:window on:resize={handleResize} on:keydown={handleKeydown} />
<svelte:window
on:keydown={handleKeydown}
/>

<div
class="map-wrapper"
Expand Down

1 comment on commit 21dd3ab

@vercel
Copy link

@vercel vercel bot commented on 21dd3ab Jun 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.