From ebbca907369d3eb4534dc53fefc7d5324ea9e3b2 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Mon, 2 Sep 2019 11:13:56 +0800 Subject: [PATCH] fix(map) style --- package.json | 2 +- src/map/AMap.js | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 30a45bb8d6..d826e2a0d0 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antv/l7", - "version": "1.3.3-beta.0", + "version": "1.3.3-beta.1", "description": "Large-scale WebGL-powered Geospatial Data Visualization", "main": "build/L7.js", "homepage": "https://github.com/antvis/l7", diff --git a/src/map/AMap.js b/src/map/AMap.js index e86c2c6776..db350a4b7f 100644 --- a/src/map/AMap.js +++ b/src/map/AMap.js @@ -42,21 +42,30 @@ export default class GaodeMap extends Base { case 'light': this.set('mapStyle', Theme.LightTheme.mapStyle); break; + case 'blank': + this.set('mapStyle', 'blank'); + break; default: this.set('mapStyle', mapStyle); } } - this.set('zooms', [this.get('minZoom'), this.get('maxZoom')]); + this.set('zooms', [ this.get('minZoom'), this.get('maxZoom')]); const map = this.get('map'); if (map instanceof AMap.Map) { this.map = map; this.container = map.getContainer(); this.get('mapStyle') && this.map.setMapStyle(this.get('mapStyle')); + if (this.get('mapStyle') === 'blank') { + map.setFeatures([]); + } this.addOverLayer(); setTimeout(() => { this.emit('mapLoad'); }, 50); } else { this.map = new AMap.Map(this.container, this._attrs); this.map.on('complete', () => { + if (this.get('mapStyle') === 'blank') { + map.setFeatures([]); + } this.addOverLayer(); this.emit('mapLoad'); }); @@ -152,13 +161,14 @@ export default class GaodeMap extends Base { case 'light': this.set('mapStyle', Theme.LightTheme.mapStyle); break; - case 'blank': - map.setFeature([]); - break; default: this.set('mapStyle', style); } - return map.setMapStyle(this.get('mapStyle')); + map.setMapStyle(this.get('mapStyle')); + if (style === 'blank') { + map.setFeatures([]); + } + return; }; scene.setZoomAndCenter = (zoom, center) => { const lnglat = new AMap.LngLat(center[0], center[1]);