Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When calling underlying Leaflet JavaScript functions the leaflet.drupal.js wrapper does not allow the optional hash of options to be passed through.
Example:
lMap.fitBounds(new L.LatLngBounds(lMap.bounds));
could be called as...
lMap.fitBounds(new L.LatLngBounds(lMap.bounds), options);
The following Leaflet functions allow for options, but the wrapper does not pass them through:
- Marker
- MultiPolygon
- MultiPolyline
- Polygon
- fitBounds
Comment | File | Size | Author |
---|---|---|---|
#3 | leaflet-allowLeafletJavascriptOptions-2348449-3.patch | 2.63 KB | sano |
#1 | leaflet-allowLeafletJavascriptOptions-2348449-1.patch | 2.37 KB | caxy4 |
Comments
Comment #1
caxy4 CreditAttribution: caxy4 commentedThis patch updates the leaflet.drupal.js wrapper around the Leaflet JavaScript library to allow for options to be passed to the functions listed in the description.
Comment #2
caxy4 CreditAttribution: caxy4 commentedComment #3
sano CreditAttribution: sano as a volunteer commentedThe patch in #1 failed at hunk 5, so I made a change to make it work. I was hoping it would address my problem, but it did not. Thanks anyways, maybe it will come handy if I am forced to hack my own solution together to make the autozoom work.
Comment #4
itamair CreditAttribution: itamair commentedTnx and sorry ... It seems that I am the only active maintainer for the Leaflet module, but actually I am taking care of the 8.x branch,
and not able to follow, fix bugs and face features requests, and even review functionalities.
Actually I don't even have a Drupal 7 playground (and don't have time to set it up) to test them.
Evan I am not able to grant new maintainer privileges.
So ... I would be able just to commit new patches to dev, and just if they are 99% tested and reviewed by you external contributors.
So do that, and eventually under your responsibility ask me to commit to dev if really needed (will try to do that in my spare time).
Comment #5
sano CreditAttribution: sano as a volunteer commented@itamair I agree - let's wait and see if more folks find this useful and then the patch can be committed into the dev branch. Thank you for your work.
Comment #6
thfalvar CreditAttribution: thfalvar commentedHi there,
I'm using Drpupal 7, leaflet 7.x.1.4, and Leaflet JavaScript Library 1.3.1. I use Drupal but I do not do any coding.
I would simply like to do an "overlay" like this: https://www.mapbox.com/mapbox.js/example/v1.0.0/imageoverlay-georeferenced/
For that I'm just doing a little module with hook_leaflet_map_info ()
Support for both "urlTemplate" and "layer_type" is good but impossible to set "bounds" as mentioned in leaflet documentation imageBounds = L.latLngBounds ([[53.0, -5.0], [40.58, 19.17]] );
Do you think this is the same problem as you: "options" mismanaged? I tried your patch but it does not change anything.
Have an idea?
Thank you