Closed emranch31 closed 6 years ago
anyone ?
Based on the example code you've provided, I don't see a link between your issue and this plugin.
L.Icon
and L.Marker
are both provided by the core Leaflet library. If you have general questions about integrating Leaflet into your application, I recommend that you ask on Stack Overflow (use the tag "leaflet').
If you believe that the issue you're experiencing is caused by this plugin, please create a minimal example (http://sscce.org/) showing how this plugin causes the issue, and I will do my best to take a look.
I resolved it... Thanks for the responding...Please close this
I am extending icon size to medium, small and large
Here is my code
$(document).on("click", ".mediumicon", function () {
drawnItems.eachLayer(function (layer) {
console.log(layer)
if (layer instanceof L.Marker) {
L.Icon.Medium = L.Icon.Default.extend({
options: {
iconSize: new L.Point(41, 41),
iconUrl: layer.dragging._marker._icon.currentSrc,
}
});
var medium = new L.Icon.Medium();
if (map.getBounds().contains(layer.getLatLng())) {
layer.setIcon(medium);
}
}
});
L.Icon.Default.prototype.options.iconSize = [41, 41];
});
Before removing all marker it is working fine but if I remove all markers and then add and click to button to make it small, large or medium, it gives me an error on this line
layer.dragging._marker._icon.currentSrc
says can not read property '_marker' of undefined
I can post both objects as well but in general, before all markers remove and after, there is a significant difference in both objects and mostly missing many properties