fix imageoverlay setBound when not added to map
If imageoverlay#setBounds is called when the layer is not added to a map, the _reset method gets errors on execution
This commit is contained in:
parent
28bbd81204
commit
93c2b52604
@ -5,4 +5,13 @@ describe('ImageOverlay', function () {
|
|||||||
expect(overlay.options.opacity).to.equal(0.5);
|
expect(overlay.options.opacity).to.equal(0.5);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe('#setBounds', function () {
|
||||||
|
it('sets bounds', function () {
|
||||||
|
var bounds = new L.LatLngBounds(
|
||||||
|
new L.LatLng(14, 12),
|
||||||
|
new L.LatLng(30, 40));
|
||||||
|
var overlay = L.imageOverlay().setBounds(bounds);
|
||||||
|
expect(overlay._bounds).to.equal(bounds);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -88,7 +88,9 @@ L.ImageOverlay = L.Layer.extend({
|
|||||||
setBounds: function (bounds) {
|
setBounds: function (bounds) {
|
||||||
this._bounds = bounds;
|
this._bounds = bounds;
|
||||||
|
|
||||||
|
if (this._map) {
|
||||||
this._reset();
|
this._reset();
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user