Do not try to remove drag class if marker as no icon
Since 4c46abe781
it's possible
to have a marker off the map with dragging still enabled.
We want to be able to disable it in this situation too.
This commit is contained in:
parent
a998f9b6c8
commit
5b3ba078bf
@ -41,10 +41,16 @@ describe("Marker", function () {
|
||||
|
||||
expect(marker.dragging.enabled()).to.be(true);
|
||||
|
||||
map.removeLayer(marker);
|
||||
map.removeLayer(marker);
|
||||
map.addLayer(marker);
|
||||
|
||||
expect(marker.dragging.enabled()).to.be(true);
|
||||
|
||||
map.removeLayer(marker);
|
||||
// Dragging is still enabled, we should be able to disable it,
|
||||
// even if marker is off the map.
|
||||
marker.dragging.disable();
|
||||
map.addLayer(marker);
|
||||
});
|
||||
|
||||
it("changes the icon to another DivIcon", function () {
|
||||
|
@ -30,7 +30,9 @@ L.Handler.MarkerDrag = L.Handler.extend({
|
||||
dragend: this._onDragEnd
|
||||
}, this).disable();
|
||||
|
||||
L.DomUtil.removeClass(this._marker._icon, 'leaflet-marker-draggable');
|
||||
if (this._marker._icon) {
|
||||
L.DomUtil.removeClass(this._marker._icon, 'leaflet-marker-draggable');
|
||||
}
|
||||
},
|
||||
|
||||
moved: function () {
|
||||
|
Loading…
Reference in New Issue
Block a user