leaflet-touch-helper
leaflet-touch-helper copied to clipboard
Does not seem to be working with the current Leaflet
No error is shown in the console.
I've just implemented it and it seems to work fine for me, can you provide your implementation?
SVG renderer is used, not a canvas one.
I am using the default renderer, which if I'm not mistaking is an SVG renderer?
Unfortunately, I don't have the code I was testing with as I have made many changes since then. But, just the basic example does not work:
L.path.touchHelper(core.paths["5-7717142810"]).addTo(map);
Uncaught TypeError: path is undefined
initialize http://xxxx/js/leaflet-touch-helper.js:10
i http://xxxx/js/leaflet.js:5
touchHelper http://xxxx/js/leaflet-touch-helper.js:59
<anonymous> debugger eval code:1
changing to L.Path does not work either
I am using the following leaflet extensions:
<script src="/js/leaflet.js"></script>
<script src="/js/leaflet.markercluster.js"></script>
<script src="/js/easy-button.js"></script>
<script src="/js/leaflet.markercluster.layersupport.js"></script>
<script src="/js/leaflet.textpath.js"></script>
<script src="/js/leaflet-touch-helper.js"></script>
The polyline I am trying to add touchHelper to does not use clustering, but is added to a layer.
Another testing and no error is shown in the console, but no touch thickness is added either:
L.path.touchHelper(core.paths["5-909582178"], {
extraWeight: 50
}).addTo(map);
Maybe more info related: I am declaring layers like this:
core.layers.layer5 = L.layerGroup();
I see we are using different technologies, I am on ASP.NET Core MVC implementing layers using geoJSON (leaflet 1.7.1). Here is my snippet of the code in question.
L.geoJSON(geoJsonData, {
onEachFeature: function (feature, item) {
L.path.touchHelper(item, { extraWeight: 10 }).addTo(map);
},
}).addTo(map);
I'll try that and report. Thanks.
The solution proposed does not work with Leaflet.TextPath plugin, so no use to me, but thanks. As this plugin is quite old, I would say it's incompatible.