mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-08-16 16:45:22 +00:00
Fix panFocus on icon with no iconSize (#8091)
This commit is contained in:
@ -214,7 +214,19 @@ describe("Marker", function () {
|
|||||||
|
|
||||||
done();
|
done();
|
||||||
}, 100);
|
}, 100);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("pan map to focus marker with no iconSize", function (done) {
|
||||||
|
var marker = L.marker([70, 0], {icon: L.divIcon({iconSize: null})});
|
||||||
|
map.addLayer(marker);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
expect(function () {
|
||||||
|
marker._panOnFocus();
|
||||||
|
}).to.not.throwException();
|
||||||
|
|
||||||
|
done();
|
||||||
|
}, 100);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ export var Marker = Layer.extend({
|
|||||||
if (!map) { return; }
|
if (!map) { return; }
|
||||||
|
|
||||||
var iconOpts = this.options.icon.options;
|
var iconOpts = this.options.icon.options;
|
||||||
var size = point(iconOpts.iconSize);
|
var size = iconOpts.iconSize ? point(iconOpts.iconSize) : point(0, 0);
|
||||||
var anchor = iconOpts.iconAnchor ? point(iconOpts.iconAnchor) : point(0, 0);
|
var anchor = iconOpts.iconAnchor ? point(iconOpts.iconAnchor) : point(0, 0);
|
||||||
|
|
||||||
map.panInside(this._latlng, {
|
map.panInside(this._latlng, {
|
||||||
|
Reference in New Issue
Block a user