This commit is contained in:
parent
68bc39a1a8
commit
2250cee6ec
@ -121,6 +121,12 @@ describe("Map", function () {
|
||||
expect(map.getZoom()).to.be(13);
|
||||
expect(map.getCenter().distanceTo([51.505, -0.09])).to.be.lessThan(5);
|
||||
});
|
||||
it("can be passed without a zoom specified", function () {
|
||||
map.setZoom(13);
|
||||
expect(map.setView([51.605, -0.11])).to.be(map);
|
||||
expect(map.getZoom()).to.be(13);
|
||||
expect(map.getCenter().distanceTo([51.605, -0.11])).to.be.lessThan(5);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#getBounds", function () {
|
||||
|
@ -56,11 +56,16 @@ L.Map = L.Class.extend({
|
||||
|
||||
// replaced by animation-powered implementation in Map.PanAnimation.js
|
||||
setView: function (center, zoom) {
|
||||
zoom = zoom === undefined ? this.getZoom() : zoom;
|
||||
this._resetView(L.latLng(center), this._limitZoom(zoom));
|
||||
return this;
|
||||
},
|
||||
|
||||
setZoom: function (zoom, options) {
|
||||
if (!this._loaded) {
|
||||
this._zoom = this._limitZoom(zoom);
|
||||
return this;
|
||||
}
|
||||
return this.setView(this.getCenter(), zoom, {zoom: options});
|
||||
},
|
||||
|
||||
|
@ -6,7 +6,7 @@ L.Map.include({
|
||||
|
||||
setView: function (center, zoom, options) {
|
||||
|
||||
zoom = this._limitZoom(zoom);
|
||||
zoom = zoom === undefined ? this._zoom : this._limitZoom(zoom);
|
||||
center = L.latLng(center);
|
||||
options = options || {};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user