diff --git a/demos/01_point_circle.html b/demos/01_point_circle.html index b941be5cd1..f062d98a56 100644 --- a/demos/01_point_circle.html +++ b/demos/01_point_circle.html @@ -92,7 +92,7 @@ scene.on('loaded', () => { .render(); setTimeout(()=>{ - scene.destroy(); + scene.setMapStyle('grey'); },2000) }); diff --git a/src/component/popup.js b/src/component/popup.js index 1de80ff6f4..7066821ddd 100644 --- a/src/component/popup.js +++ b/src/component/popup.js @@ -23,6 +23,7 @@ export default class Popup extends Base { this._scene.on('click', this._onClickClose); }, 30); } + return this; } setLnglat(lngLat) { this.lngLat = lngLat; diff --git a/src/map/AMap.js b/src/map/AMap.js index 13864b6b00..f1fb6c9d8a 100644 --- a/src/map/AMap.js +++ b/src/map/AMap.js @@ -38,13 +38,13 @@ export default class GaodeMap extends Base { if (mapStyle) { switch (mapStyle) { case 'dark': - this.set('mapStyle', Theme.DarkTheme.mapStyle); + this.set('mapStyle', Theme.darkTheme.mapStyle); break; case 'light': - this.set('mapStyle', Theme.LightTheme.mapStyle); + this.set('mapStyle', Theme.lightTheme.mapStyle); break; case 'blank': - this.set('mapStyle', 'blank'); + this.set('mapStyle', Theme.blankTheme.mapStyle); break; default: this.set('mapStyle', mapStyle); @@ -122,10 +122,13 @@ export default class GaodeMap extends Base { const map = this.map; switch (style) { case 'dark': - this.set('mapStyle', Theme.DarkTheme.mapStyle); + this.set('mapStyle', Theme.darkTheme.mapStyle); break; case 'light': - this.set('mapStyle', Theme.LightTheme.mapStyle); + this.set('mapStyle', Theme.lightTheme.mapStyle); + break; + case 'blank': + this.set('mapStyle', Theme.blankTheme.mapStyle); break; default: this.set('mapStyle', style); @@ -134,7 +137,8 @@ export default class GaodeMap extends Base { map.setMapStyle(this.get('mapStyle')); if (style === 'blank') { map.setFeatures([]); - } else { + } else + if (map.getFeatures().length === 0) { map.setFeatures(defaultMapFeatures); } return; diff --git a/src/theme/blank.js b/src/theme/blank.js new file mode 100644 index 0000000000..307b79c0bf --- /dev/null +++ b/src/theme/blank.js @@ -0,0 +1,4 @@ +const BlankTheme = { + mapStyle: 'amap://styles/07c17002b38775b32a7a76c66cf90e99?isPublic=true' +}; +export default BlankTheme; diff --git a/src/theme/index.js b/src/theme/index.js index 7b4cd3a988..46b7c454e1 100644 --- a/src/theme/index.js +++ b/src/theme/index.js @@ -1,3 +1,4 @@ -import DarkTheme from './dark'; -import LightTheme from './light'; -export { DarkTheme, LightTheme }; +import darkTheme from './dark'; +import lightTheme from './light'; +import blankTheme from './blank'; +export { darkTheme, lightTheme, blankTheme };