Recently I had to implements features that might face multiple Leaflet Markeclusters maps (fit bounds), interactions from outside of the clustered map & View AJAX calls .
I succeeded in all this, as you can see in this project page: http://www.italomairo.com/geoblogcms/en/ip-locations-leaflet
that strongly use the Leaflet and Leaflet markeclusters and IP Geolocation Views & Maps modules.
But for make all this properly working had to hack and fit the leaflet and leaflet markeclusters javascript files.
Here attached is the diff file for the leaflet_markercluster.drupal.js I use now, properly commented in the added/amended code lines.
All this is strictly related to (and fix) other issues like:
#2005334: Interaction with Map and Map Features form outside of the Leaflet Markerclustered map
#2040639: Fit to Features Bounds get Bounds increments of all map's features, when more than one map in the page (Fixed!)
#2038659: Leaflet MarkerCluster ENABLED (!) on all maps if more than one map is shown per page (with IP_Geoloc module)
Last, but not least, this issue is the correspondent of its analogue in the Leaflet Module (#2056551: (my) Improvements for multiple Leaflet maps (fit bounds), interactions from outside of the map & View AJAX calls )
| Comment | File | Size | Author |
|---|---|---|---|
| leaflet_markeclusters_js.diff | 7.84 KB | itamair |
Comments
Comment #1
rdeboerThanks Italo,
So just to clarify. You are saying that this one patch (.diff file attached), fixes the above 3 issues:
#2005334: Interaction with Map and Map Features form outside of the Leaflet Markerclustered map
#2040639: Fit to Features Bounds get Bounds increments of all map's features, when more than one map in the page (Fixed!)
#2038659: Leaflet MarkerCluster ENABLED (!) on all maps if more than one map is shown per page (with IP_Geoloc module)
Right?
And then when using Leaflet without Leaflet MarkerCluster, the patch is in:
#2056551: (my) Improvements for multiple Leaflet maps (fit bounds), interactions from outside of the map & View AJAX calls
Right?
Rik
Comment #2
itamair commentedHi Rik … yes that's right. I meant exactly that! … besides any further possible improvements (so far I arrived here, successfully)
Bear in mind that I had to hack the leaflet_markercluster.drupal.js file in the way that it completely overrides the leaflet.drupal.js file (that won't be loaded/called by the view style plugin …)
That's why the same Drupal.behaviors.leaflet is invoked in both (with the same namespace) and why the same Drupal.leaflet object should be defined at the end of the leaflet_markercluster.drupal.js too.
For what concerns the IP Geolocation Views & Maps module this issue request (https://drupal.org/node/2039309) should be implemented too.
Really hope I am understandable in all this.
Let me know otherwise …
Italo
Comment #2.0
berliner commentedReadability: Changed linking to other issues.
Comment #3
thomas.lobjoie commentedThanks, Italo ! Just used your diff file, all works fine now!
Comment #4
rdeboerHi Italo,
Could you create a new version of this patch, as so much has changed in Leaflet that the changes need to be re-synchronised?
Rik