Skip to content

Commit

Permalink
mapLibre.ts - stop the popups from moving around when panning
Browse files Browse the repository at this point in the history
MapLibre pop-ups by default try to resist going off-screen when
panned.  This causes a bit of havoc when small-screen users try to
pan, because the pop-up jumps around unpredicably.

But if we specify where to put the anchor, the pop-up will stick with
that and stay still with respect to the tiling.
  • Loading branch information
Nick Stokoe committed Nov 26, 2024
1 parent 4b6f360 commit 9a19fde
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions apps/front-end/src/components/map/mapLibre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const openPopup = async (
popup = new Popup({
closeButton: false,
maxWidth: "none",
anchor: "bottom",
})
.setLngLat(coordinates)
.setHTML(`<div id=${POPUP_CONTAINER_ID}></div>`)
Expand Down

0 comments on commit 9a19fde

Please sign in to comment.