DigitalCommons / mykomap

A web application for mapping initiatives in the Solidarity Economy
3 stars 0 forks source link

Default Lat Long not being handled correctly #192

Closed ColmDC closed 1 year ago

ColmDC commented 1 year ago

Describe the bug In bleeding edge on https://dev.maps.solidarityeconomy.coop/temp/obo-public/?defaultLatLng=50,-2 When a default Lat long is set in arguments it seems to be ignored.

To Reproduce See vid below

Expected behavior When you select an initiative without a valid location, the dialog should appear at the default lat long and the map pan to it. Also there should be no marker or icon for the initiative.

Desktop (please complete the following information):

Screenshots https://www.awesomescreenshot.com/video/15864411?key=f0854c22f0866618e162592acf895022

ColmDC commented 1 year ago

" The (location-less) markers seem to go into the right place, so that's not a problem I think.

The problem with #192 is that location-less markers still appear, and attempt to spiderify. I'm trying to work out how that works, and so how to get it to show the pop-up but not the marker."

ColmDC commented 1 year ago

This seems to work nicely again in mykomap@3.0.4_a7ab438-modified-dev on OBO and Co-ops UK

ColmDC commented 1 year ago

Did you want to put some closing comments here and then close @wu-lee ?

wu-lee commented 1 year ago

Thanks for adding my earlier comments.

My closing comments: I fixed this, although it was a bit tricky to because the code's got some misleading names in it.

Dev note: It uses a Leaflet plugin leafler.markercluster, which does the clustering - i.e. elide closely-located groups of markers with a marker showing a number, which splits up as you zoom in.

There's one main cluster group - which was called unselectedMarkerGroup, and contained all the normal pins. The other was called both selectedMarkerGroup and hiddenClusterGroup (in different places), and contained the location-less markers. The markers in the latter group had their icons disabled (somehow!), but their pop-ups still worked. However, it hadn't the clustering function disabled, so when zoomed out, the invisible icons were replaced with a visible cluster icon, and/or a spider diagram.

Disabling the latter cluster group's clustering by setting the option disableCluteringAtZoom to 0 stopped this happening.

So non-geographic initiatives are hidden, but we still get pop-ups when clicked in the sidebar.

I've also renamed the clusters to geoClusterGroup and nonGeoClusterGroup.

wu-lee commented 1 year ago

ps There seems to have been some functionality dating from the era of Matt for selecting markers, which doesn't seem to exist now - this explains the old names. The hiddenClusterGroup was added later by Joe.