Shihuidev (#870)

fix: 修复重复销毁bug

 style: lint style
This commit is contained in:
YiQianYao 2021-12-08 14:13:34 +08:00 committed by GitHub
parent 90df704ca4
commit 5b10e163ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 12 deletions

View File

@ -25,12 +25,13 @@
"author": "antv",
"license": "MIT",
"dependencies": {
"@antv/l7-component": "^2.6.8",
"@antv/l7-core": "^2.6.8",
"@antv/l7-layers": "^2.6.8",
"@antv/l7-maps": "^2.6.8",
"@antv/l7-scene": "^2.6.8",
"@antv/l7-utils": "^2.6.8",
"@antv/l7-component": "^2.6.7",
"@antv/l7-core": "^2.6.7",
"@antv/l7-source": "^2.6.7",
"@antv/l7-layers": "^2.6.7",
"@antv/l7-maps": "^2.6.7",
"@antv/l7-scene": "^2.6.7",
"@antv/l7-utils": "^2.6.7",
"@babel/runtime": "^7.7.7"
},
"gitHead": "684ba4eb806a798713496d3fc0b4d1e17517dc31",

View File

@ -770,11 +770,9 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
this.styleAttributeService.clearAllAttributes();
// 执行每个图层单独的 clearModels 方法 (清除一些额外的 texture、program、buffer 等)
this.layerModel.clearModels();
this.hooks.afterDestroy.call();
// TODO: 给外部使用
// TODO: 清除各个图层自定义的 models 资源
this.layerModel?.clearModels();
// @ts-ignore

View File

@ -1,28 +1,28 @@
import { Scene, PolygonLayer, PointLayer, Map } from '@antv/l7-mini';
// import { Scene } from '@antv/l7';
// import { PolygonLayer, PointLayer } from '@antv/l7-layers';
// import { Map } from '@antv/l7-maps';
import { GaodeMap } from '@antv/l7-maps';
import * as React from 'react';
export default class ScaleComponent extends React.Component {
public async componentDidMount() {
const scene = new Scene({
id: 'map',
map: new Map({
map: new GaodeMap({
hash: true,
center: [105, 32],
pitch: 0,
zoom: 3,
}),
});
scene.setBgColor('#000');
// scene.setBgColor('#000');
fetch(
'https://gw.alipayobjects.com/os/basement_prod/d2e0e930-fd44-4fca-8872-c1037b0fee7b.json',
)
.then((res) => res.json())
.then((data) => {
const layer = new PolygonLayer({ blend: 'normal' })
const layer = new PolygonLayer({ blend: 'normal' }) // autoFit: true
.source(data)
.size('name', [0, 10000, 50000, 30000, 100000])
.color('name', [
@ -44,6 +44,11 @@ export default class ScaleComponent extends React.Component {
});
scene.addLayer(layer);
scene.fitBounds([
[48.073279, 3.067261],
[160.573279, 54.003394],
]);
const layer2 = new PolygonLayer({ blend: 'normal' })
.source(data)
.size(1)