Skip to content

feat(map): list only the places in the visible map area - #363

Merged
yakew7 merged 2 commits into
mainfrom
fix/places-in-view
Nov 24, 2026
Merged

yakew7 merged 2 commits into
mainfrom
fix/places-in-view

Conversation

@propcgamer20-png

Copy link
Copy Markdown
Member

Builds on #360. This branch starts from that one (both change the map's viewport reporting), so until #360 merges the diff here also shows its commit. Please merge #360 first; the only commit specific to this PR is feat(map): list only the places in the visible map area.

What this changes

#351: the results list was driven by filters only, so panning to Lagos still listed Heathrow first.

  • An "Only places in this view" switch limits the list to the area the map showed. It is on by default from zoom 8 and off below it (a whole-region view is better listed in full), and the visitor's own choice overrides that.
  • The panel line now reads "N places in this view" or "N places total".
  • The list is pinned to one area. When the map moves, a "Search this area" button appears instead of re-sorting rows under the visitor's cursor mid-scroll; tapping it lists the new area.
  • Nearest-first still applies when a location is set (it sorts the in-view places).
  • The map now reports its visible bounds with each viewport change. The bounds are not written to the URL or to storage.
  • Desktop panel and mobile sheet share one MapPanel, so both get it.
  • The bounds logic (inBounds, filterByBounds, sameBounds, wantsInView) is in filters.ts with its own tests, including a view that crosses the antimeridian.

Type of change

  • Code or fix

Testing

Not covered

  • Checked through unit tests, not by eye in a browser (no MapTiler key on my machine). Worth a look on the preview: pan and zoom on desktop and in the mobile sheet.
  • No test for nearest-first inside the view (it needs the geolocation flow); the code path is the same list the test above covers, sorted by distance.
  • No changelog line, to avoid conflicts with the other open PRs.

Closes #351

…view

A search that leaves one place fitted a zero-size box and zoomed to level
19, where the basemap is blank. The fit is now capped (16 for one place,
15 for several) and the go-to-place zoom shares one constant.

The map used to open on the whole world with grey bands above and below
the tiles. It now keeps the basemap covering the viewport with a minimum
zoom, reopens where the visitor last left it (localStorage, guarded), and
opens on a signed-in visitor's saved home when nothing else chose a view.
An explicit lat/lng/zoom, place, search or filter in the URL still wins,
and nothing asks for geolocation on load.

Closes #350
Closes #353
…h this area prompt

The results list was driven by filters only, so panning to Lagos still
listed Heathrow first. An 'Only places in this view' switch (on by default
from zoom 8) limits the list to the area the map showed, and the header now
reads 'N places in this view' or 'N places total'.

The list is pinned to one area: moving the map shows a 'Search this area'
button instead of re-sorting rows under the visitor's cursor mid-scroll.
Nearest-first still applies when a location is set. The map now reports its
visible bounds; they are kept out of the URL and storage. Works in the
desktop panel and the mobile sheet, which share one MapPanel.

Closes #351
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
study-map Ready Ready Preview Nov 24, 2026 9:23am UTC

@yakew7
yakew7 merged commit a3defbd into main Nov 24, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — faef1070 Deployed Nov 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Results list shows every place in the dataset, not the ones on screen

2 participants