You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a marker gets snapped to another marker before it was unsnapped from from the previous marker, no unsnap event is fired. Here is a working proposal to fix the issue by first firing the unsnap event before doing a new snap:
L.Snap.updateSnap = function (marker, layer, latlng) {
if (! marker.hasOwnProperty('_latlng')) {
return;
}
if(marker.snap != layer){
if (marker.snap) {
if (marker._icon) {
L.DomUtil.removeClass(marker._icon, 'marker-snapped');
}
marker.fire('unsnap', {layer: marker.snap});
}
delete marker.snap;
}
if (layer && latlng) {
// don't call setLatLng so that we don't fire an unnecessary 'move' event
marker._latlng = L.latLng(latlng);
marker.update();
if (marker.snap != layer) {
marker.snap = layer;
if (marker._icon) {
L.DomUtil.addClass(marker._icon, 'marker-snapped');
}
marker.fire('snap', {layer:layer, latlng: latlng});
}
}
};
The text was updated successfully, but these errors were encountered:
sidney-pauly
changed the title
Unsnap events don't get fired reliably [BUG]
Unsnap events don't get fired reliably
Nov 21, 2019
If a marker gets snapped to another marker before it was unsnapped from from the previous marker, no unsnap event is fired. Here is a working proposal to fix the issue by first firing the unsnap event before doing a new snap:
The text was updated successfully, but these errors were encountered: