From 09ebe2981eff86b396594e73f975316370eb42e6 Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Fri, 27 Sep 2019 17:52:42 +0800 Subject: [PATCH] fix: control css --- demos/heatmap.html | 6 +++++- src/map/AMap.js | 10 ++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/demos/heatmap.html b/demos/heatmap.html index 0a5d3ff327..4c2987a158 100644 --- a/demos/heatmap.html +++ b/demos/heatmap.html @@ -29,7 +29,7 @@ const scene = new L7.Scene({ window.scene = scene; scene.on('loaded', () => { $.get('https://gw.alipayobjects.com/os/basement_prod/08c6ea00-dc5f-4bb0-b0b5-52bde5edf0a3.json', data => { - scene.HeatmapLayer({ + const layer = scene.HeatmapLayer({ zIndex: 2 }) .source(data) @@ -44,6 +44,10 @@ scene.on('loaded', () => { } }) .render(); + setTimeout(()=>{ + scene.removeLayer(layer) + },1000) + /*scene.PointLayer({ zIndex: 2 }) diff --git a/src/map/AMap.js b/src/map/AMap.js index f1fb6c9d8a..83780573dd 100644 --- a/src/map/AMap.js +++ b/src/map/AMap.js @@ -3,7 +3,6 @@ import Global from '../global'; import * as Theme from '../theme/index'; import Util from '../util'; const DEG2RAD = Math.PI / 180; -const defaultMapFeatures = [ 'bg', 'point', 'road', 'building' ]; export default class GaodeMap extends Base { getDefaultCfg() { return Util.assign(Global.scene, { @@ -105,12 +104,10 @@ export default class GaodeMap extends Base { return this.projectFlat(this.getCenter()); } addOverLayer() { - // const canvasContainer = this.container instanceof HTMLElement ? this.container : document.getElementById(this.container); - // this.canvasContainer = canvasContainer; this.amapContainer = this.map.getContainer().getElementsByClassName('amap-maps')[0]; this.renderDom = document.createElement('div'); this.renderDom.style.cssText += - 'position: absolute;top: 0;height: 100%;width: 100%;pointer-events: none;'; + 'position: absolute;top: 0;height: 100%;width: 100%;pointer-events: none;background: white;'; this.renderDom.id = 'l7_canvaslayer'; this.amapContainer.appendChild(this.renderDom); @@ -136,10 +133,7 @@ export default class GaodeMap extends Base { map.setMapStyle(this.get('mapStyle')); if (style === 'blank') { - map.setFeatures([]); - } else - if (map.getFeatures().length === 0) { - map.setFeatures(defaultMapFeatures); + map.setLayers([]); } return; }