diff --git a/src/layer/tile/TileLayer.ts b/src/layer/tile/TileLayer.ts index fde2e8b634..8bfc426bb9 100644 --- a/src/layer/tile/TileLayer.ts +++ b/src/layer/tile/TileLayer.ts @@ -1537,7 +1537,7 @@ export type TileLayerOptionsType = LayerOptionsType & { urlTemplate: string | ((...args) => string); subdomains?: string[]; spatialReference?: SpatialReferenceType; - tileSize?: number[]; + tileSize?: number[] | number; offset?: number[] | ((...args) => number[]); tileSystem?: [number, number, number, number]; maxAvailableZoom?: number; diff --git a/src/map/Map.ts b/src/map/Map.ts index 678c127d3b..9445f983b6 100644 --- a/src/map/Map.ts +++ b/src/map/Map.ts @@ -570,7 +570,7 @@ export class Map extends Handlerable(Eventable(Renderable(Class))) { this._center = center; return this; } - this._centerZ = center.z || 0; + this._centerZ = center.z; this.onMoveStart(); this._setPrjCenter(pcenter); this.onMoveEnd(this._parseEventFromCoord(this.getCenter())); diff --git a/test/map/MapSpec.js b/test/map/MapSpec.js index 3a05c417cc..2a8f3c76ea 100644 --- a/test/map/MapSpec.js +++ b/test/map/MapSpec.js @@ -181,6 +181,7 @@ describe('Map.Spec', function () { it('center is changed after setCenter', function () { var nc = new maptalks.Coordinate(119, 32).copy(); map.setCenter(nc); + expect(map._centerZ === undefined).to.be.ok(); expect(map.getCenter()).to.closeTo(nc); }); @@ -555,7 +556,6 @@ describe('Map.Spec', function () { map._getRenderer()._checkSizeInterval = 10; // this.timeout(map._getRenderer()._checkSizeInterval * 3); var center = map.getCenter(); - center.z = center.z || 0; map.once('resize', function (param) { expect(param).to.be.ok(); //center remains diff --git a/test/map/MapViewHistorySpec.js b/test/map/MapViewHistorySpec.js index 343c7e12f5..f279ebdef2 100644 --- a/test/map/MapViewHistorySpec.js +++ b/test/map/MapViewHistorySpec.js @@ -57,7 +57,7 @@ describe('Map View History', function () { renderer.callInNextFrame(function () { map.zoomToPreviousView(); var next = map.zoomToNextView(); - expect(next.center).to.be.eql([0, 0, 0]); + expect(next.center).to.be.eql([0, 0]); expect(next.zoom).to.be.eql(zoom - 1); expect(map.hasNextView()).not.to.be.ok(); diff --git a/test/map/control/Control.OverviewSpec.js b/test/map/control/Control.OverviewSpec.js index ac65ded691..a9ea70f302 100644 --- a/test/map/control/Control.OverviewSpec.js +++ b/test/map/control/Control.OverviewSpec.js @@ -71,7 +71,7 @@ describe('Control.Overview', function () { var overview = new maptalks.control.Overview(); overview.addTo(map); map.on('viewchange', function () { - expect(overview._overview.getCenter().toArray()).to.be.eql([0, 0, 0]); + expect(overview._overview.getCenter().toArray()).to.be.eql([0, 0]); done(); }); map.setCenter([0, 0]); diff --git a/test/map/control/Control.ResetSpec.js b/test/map/control/Control.ResetSpec.js index 7140e2df42..50992143f8 100644 --- a/test/map/control/Control.ResetSpec.js +++ b/test/map/control/Control.ResetSpec.js @@ -37,7 +37,7 @@ describe('Control.Reset', function () { happen.click(control._reset); expect(map.getView()).to.eql({ - center: [120, 20, 0], + center: [120, 20], zoom: 8, bearing: 10, pitch: 30 @@ -51,7 +51,7 @@ describe('Control.Reset', function () { happen.click(control._reset); expect(map.getView()).to.eql({ - center: [118, 32, 0], + center: [118, 32], zoom: 5, bearing: 0, pitch: 0