Skip to content

Improve the search a bit#665

Open
stuartlangridge wants to merge 3 commits into
NerdyDayTrips:mainfrom
stuartlangridge:search-tweaks
Open

Improve the search a bit#665
stuartlangridge wants to merge 3 commits into
NerdyDayTrips:mainfrom
stuartlangridge:search-tweaks

Conversation

@stuartlangridge

Copy link
Copy Markdown
Contributor
  • When doing a search, reposition the map to show only the results, not the whole world
  • When dragging the map with search results visible, indicate which ones are now off the map
  • Highlight a map marker on mouseover of its search result

We do this by calculating the bounds of all displayed markers.
This requires a certain amount of jiggery-pokery because we want to zoom the map to show the markers, then calculate the distance to each marker from the centre of the newly zoomed map.
We also do not want to zoom you back to the bounding box if you dragged the map manually.
@popey

popey commented Jun 12, 2025

Copy link
Copy Markdown
Contributor

Nice. This breaks the "jump to the pin" that currently happens when you click the pin icon in the top right, and allow location in the browser.

@stuartlangridge

Copy link
Copy Markdown
Contributor Author

hm does it? what should it be doing that it now isn't? it seems to work for me locally

@popey

popey commented Jun 12, 2025

Copy link
Copy Markdown
Contributor

A video:

  • 0m0s - currently deployed site
    • Jiggle map around, click pin, map zooms directly to current location
    • Search for museum, results show, but map doesn't move
    • Zoom out and move the map, click pin, map zooms directly to current location again
  • 0m22s - this pull request
    • Click pin, map zooms to current location as expected
    • Search for museum, results show, and map zooms out to show them all (I don't think it should do this, it should stay focused on whatever it was. I don't care about museums in Australia right now)
    • Click pin, map stays zoomed out. There's a pin in there somewhere. (I don't think it should do this either, as I clicked the pin for a reason, to show what's nearby)

Drat, video too long to upload.... (uploading to youtube)

https://www.youtube.com/watch?v=cBk2HuWnMNo

@stuartlangridge

Copy link
Copy Markdown
Contributor Author

OK, so there are two issues here, I think.

  1. when we do a search, and calculate the bounds of that search, if the bounds are bigger than the current map bounds we should not zoom to show everything; we should leave it as it is. That would neatly solve that, I think, and is correct.
  2. we are overriding the locate-me pin so it doesn't work. This one, I'm not sure why, so I'll have to look into it.

@popey

popey commented Nov 9, 2025

Copy link
Copy Markdown
Contributor

@stuartlangridge fancy taking another look at this? :)

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.

2 participants