community-platform icon indicating copy to clipboard operation
community-platform copied to clipboard

[ui] Adjusting zoom level on the map when clicked on a profile

Open dalibormrska opened this issue 6 months ago • 6 comments

Is your feature request related to a problem? Please describe. In the map when clicking on a profile, the zoom level is not adjusted. This results in not really clear, since it is somewhere in the cluster. Image

This happens whenever the url of the map has the profile in it (https://community.preciousplastic.com/map/#precious-plastic), so in the map page but also when the user clicks on the country button in the profile. Image

Describe the solution you'd like Adjust the zoom level when clicking on a profile, so that the pin is not in the cluster. My suggestion would be to have also a minimum zoom so that it is clear to see the region and the country, even if it is not in a cluster by default.

So instead of seeing the whole world even if the pin is alone, Image

have a minimal zoom level to see the country more up-close. Image

Should have Could the zoom transition be done smoothly? Or is Leaflet not made for that?

Additional context

dalibormrska avatar May 12 '25 21:05 dalibormrska

I will try to work on this issue

Roemerdt avatar May 13 '25 13:05 Roemerdt

Thanks @Roemerdt. Shout if you need anything.

benfurber avatar May 13 '25 14:05 benfurber

Hey @Roemerdt, how are you getting on?

benfurber avatar May 20 '25 09:05 benfurber

@benfurber Have something working, though I could not get the desired behaviour for 100%. also wasnt sure, but writing e2e tests is required right? cuz i had not gotten started on that yet

Roemerdt avatar May 20 '25 12:05 Roemerdt

@Roemerdt Great. Not 100% is fine, we can have a look on the PR. Some kind of extra expectation on the existing map e2e tests would be good to prevent regressions.

benfurber avatar May 20 '25 12:05 benfurber

@benfurber I have opened a draft in #4242 so you can check out where its at

Roemerdt avatar May 20 '25 12:05 Roemerdt

fixed now @dalibormrska ?

davehakkens avatar Oct 28 '25 10:10 davehakkens

@davehakkens @jproberson Awesome improvement in a really good direction, the #4455 fixed quite some issues.

However, this could still use a bit more attention. The idea here was basically: If a pin is in a cluster, zoom until it is not in a cluster.

The behaviour now is that even when you are zoomed in and you see many pins, if you click on one of them you get to the maximum zoom level. This can be a bit annoying if an user is exploring the pins. Image

So the question - would it be technically doable to implement this kind of logic:

  • Check if the clicked pin is in a cluster
  • If no, just center it, don't zoom
  • If it is in a cluster then zoom to the first zoom level that is outside of the cluster

Let me know what do you think! :)) Or if you have other ideas.

An example of a nice map experience from WWOOF: Image

dalibormrska avatar Nov 04 '25 08:11 dalibormrska

@davehakkens I think that's something we can handle just fine. I'll go ahead and work on that.

jproberson avatar Nov 05 '25 00:11 jproberson

:tada: This issue has been resolved in version 2.86.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

onearmy-bot avatar Nov 09 '25 09:11 onearmy-bot