mirror of https://gitee.com/antv-l7/antv-l7
fix: style attribute Maximum call stack size exceeded
This commit is contained in:
parent
b4c39daf64
commit
bc94df0e3c
|
@ -205,10 +205,17 @@ export default class StyleAttributeService implements IStyleAttributeService {
|
|||
normals: normalsForCurrentFeature,
|
||||
size: vertexSize,
|
||||
} = this.triangulation(feature);
|
||||
indices.push(...indicesForCurrentFeature.map((i) => i + verticesNum));
|
||||
vertices.push(...verticesForCurrentFeature);
|
||||
indicesForCurrentFeature.forEach((i) => {
|
||||
indices.push(i + verticesNum);
|
||||
});
|
||||
verticesForCurrentFeature.forEach((index) => {
|
||||
vertices.push(index);
|
||||
});
|
||||
// fix Maximum call stack size exceeded https://stackoverflow.com/questions/22123769/rangeerror-maximum-call-stack-size-exceeded-why
|
||||
if (normalsForCurrentFeature) {
|
||||
normals.push(...normalsForCurrentFeature);
|
||||
normalsForCurrentFeature.forEach((normal) => {
|
||||
normals.push(normal);
|
||||
});
|
||||
}
|
||||
size = vertexSize;
|
||||
const verticesNumForCurrentFeature =
|
||||
|
|
|
@ -217,7 +217,7 @@ export default function(
|
|||
pickData.push(
|
||||
attrPos[i * 3],
|
||||
attrPos[i * 3 + 1],
|
||||
attrPos[i * 3 + 1],
|
||||
attrPos[i * 3 + 2],
|
||||
attrDistance[i],
|
||||
miters[i],
|
||||
totalDistance,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { PolygonLayer, Scene } from '@antv/l7';
|
||||
import { LineLayer, PolygonLayer, Scene } from '@antv/l7';
|
||||
import { GaodeMap } from '@antv/l7-maps';
|
||||
import * as React from 'react';
|
||||
|
||||
|
@ -19,7 +19,8 @@ export default class MultiPolygon extends React.Component {
|
|||
|
||||
public async componentDidMount() {
|
||||
const response = await fetch(
|
||||
'https://gw.alipayobjects.com/os/basement_prod/f79485d8-d86f-4bb3-856d-537b586be06e.json',
|
||||
// 'https://gw.alipayobjects.com/os/basement_prod/f79485d8-d86f-4bb3-856d-537b586be06e.json',
|
||||
'https://gw.alipayobjects.com/os/basement_prod/619a6f16-ecb0-4fca-9f9a-b06b67f6f02b.json',
|
||||
);
|
||||
const scene = new Scene({
|
||||
id: 'map',
|
||||
|
@ -27,13 +28,16 @@ export default class MultiPolygon extends React.Component {
|
|||
pitch: 0,
|
||||
style: 'dark',
|
||||
center: [121.775374, 31.31067],
|
||||
zoom: 14.1,
|
||||
zoom: 5,
|
||||
}),
|
||||
});
|
||||
|
||||
const layer = new PolygonLayer({})
|
||||
.source(await response.json())
|
||||
.shape('fill')
|
||||
const data = await response.json();
|
||||
// console.log(data.features[5]);
|
||||
// data.features = data.features.slice(6);
|
||||
const layer = new LineLayer()
|
||||
.source(data)
|
||||
.shape('line')
|
||||
.size(1)
|
||||
.color('red')
|
||||
.style({
|
||||
opacity: 1.0,
|
||||
|
|
Loading…
Reference in New Issue