Heyo,

Adding a patch to allow for configurable draw handlers.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Donnyboypony created an issue. See original summary.

smithmilner’s picture

smithmilner’s picture

To clarify, I have added a develop branch to the library which this patch is compatible with. I'd like to see this rolled into master eventually https://github.com/tnightingale/Leaflet.widget/tree/develop

smithmilner’s picture

FileSize
3.76 KB

Fixed issue with the geocoder field not working.

Shiraz Dindar’s picture

Hi again... Just confirming this works for me (geocoder works again) with latest Leaflet widget JS (your develop branch), and latest stable Leaflet JS (1.03).

smithmilner’s picture

Title: Configurable Draw Handlers » Better map widget configuration
FileSize
4.93 KB

I'm adding min and max zoom configuration elements as well. Renaming ticket to be about improved configuration in general.

miksha’s picture

Hello... Can you please help me resolve this. I downloaded Leaflet.Widget JS from your develop branch. Also, I downloaded the configurable-draw-handlers-2812687-6.patch and 7.x-2.x-dev version of Leaflet Widget for Geofield module. I applied the patch cleanly, and also put Leaflet JS 1.0.3. inside /sites/all/libraries/leaflet folder.
I am getting error on Leaflet.widget.js (Uncaught TypeError: Cannot read property 'include' of undefined that refers to L.MultiPolyline.include({...) on line 175). And also error inside widget.js (Uncaught TypeError: Cannot read property 'enable' of undefined that refers to map.widget.enable(); on line 19).
I need this to work with Leaflet 1.0.3 because I need some functions of never Leaflet script, that is missing inside 0.4 or 0.7 versions.
Maybe I'm simply not doing things right.

Thank you for your help.

Shiraz Dindar’s picture

Miksha, I was having the same issue. I made a patch for it. See here: https://www.drupal.org/project/leaflet_widget/issues/2828085#comment-118....

I also recommend you read the rest of my comments on that task, but for your specific issue that patch should do it.

miksha’s picture

Hi Shiraz. Thank you for your help. I read the complete thread and did exactly like you explained in #12, but now I am getting errors like this:

Uncaught TypeError: Cannot read property 'length' of undefined
    at NewClass._onMouseMove (leaflet.draw-src.js?v=1.x:338)
    at NewClass.fire (Events.js:185)
    at NewClass._fireDOMEvent (Map.js:1330)
    at NewClass._handleDOMEvent (Map.js:1289)
    at HTMLDivElement.handler (DomEvent.js:72)

When i try to draw shape it goes missing at the moment when I connect the last dot with the first one and I keep getting a lots of JS errors like the one I wrote.

Also my call to addControl() gives "Uncaught TypeError: myMap.addControl is not a function", and I renamed Leaflet.widget's internal Leaflet folder so that it uses the 1.0.3 from my "libraries" folder. I removed Leaflet.Draw folder that I earlier had in my "libraries" folder so that the leaflet_widget can use the one provided by Leaflet.Widget JS inside LIB folder.
Would it be too much if I asked you to attach your working versions, because Leaflet.widget JS from develop branch refused to patch with 1st patch from comment #10 in the thread. I actually commented those MultyPolyline inclusions myself. So, maybe the JS has been changed from the period you downloaded it.
Thank you.

Shiraz Dindar’s picture

@miksha, sure, it's a pretty fat stack, but I'll post it all here. There were some updates since I made that post in #12. In fact, about 4 or 5 months ago, I tried to update everything as much as I could, and this is what I was left with:

Other Leaflet (leaflet) Module Enabled 7.x-1.4
Other Leaflet MapBox (leaflet_mapbox) Module Enabled 7.x-1.5
Other Leaflet Markercluster (leaflet_markercluster) Module Enabled 7.x-1.4
Other Leaflet More Maps (leaflet_more_maps) Module Enabled 7.x-1.17
Other Leaflet views (leaflet_views) Module Enabled 7.x-1.4
Other Leaflet Widget for Geofield (leaflet_widget) Module Enabled 7.x-2.0-beta1+7-dev
Other IP Geolocation Views & Maps (ip_geoloc) Module Enabled 7.x-1.30+1-dev
Other geoPHP (geophp) Module Enabled 7.x-1.7+7-dev
Fields Geofield (geofield) Module Enabled 7.x-2.3
Other Geocoder (geocoder) Module Enabled 7.x-1.3
Other Geofield Gmap (geofield_gmap) Module Enabled 7.x-2.x-dev
Other Geofield Map (geofield_map) Module Enabled 7.x-2.3

libraries/leaflet_markercluster$ cat CHANGELOG.md
## 1.0.4 (2017-03-14)

libraries/leaflet-fullscreen$ cat CHANGELOG.md
## 1.0.2

libraries/leaflet$ cat leaflet.js
/*
Leaflet 1.0.3+ed36a04, a JS library for interactive maps. http://leafletjs.com
(c) 2010-2016 Vladimir Agafonkin, (c) 2010-2011 CloudMade
*/

libraries/Leaflet.widget
Whatever I said in #12 if not something newer that Smith released on (on the dev branch), plus the patch.

libraries/leaflet-minimap
can provide version on request. Pretty sweet bonus worked out of the box for me.

Feel free to PM me, or Skype me @shirazdindar if you think I can be of more help.