mirror of https://gitee.com/antv-l7/antv-l7
fix: style attribute Maximum call stack size exceeded
This commit is contained in:
parent
12b24b990a
commit
f2279e54a0
|
@ -205,10 +205,17 @@ export default class StyleAttributeService implements IStyleAttributeService {
|
||||||
normals: normalsForCurrentFeature,
|
normals: normalsForCurrentFeature,
|
||||||
size: vertexSize,
|
size: vertexSize,
|
||||||
} = this.triangulation(feature);
|
} = this.triangulation(feature);
|
||||||
indices.push(...indicesForCurrentFeature.map((i) => i + verticesNum));
|
indicesForCurrentFeature.forEach((i) => {
|
||||||
vertices.push(...verticesForCurrentFeature);
|
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) {
|
if (normalsForCurrentFeature) {
|
||||||
normals.push(...normalsForCurrentFeature);
|
normalsForCurrentFeature.forEach((normal) => {
|
||||||
|
normals.push(normal);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
size = vertexSize;
|
size = vertexSize;
|
||||||
const verticesNumForCurrentFeature =
|
const verticesNumForCurrentFeature =
|
||||||
|
|
|
@ -217,7 +217,7 @@ export default function(
|
||||||
pickData.push(
|
pickData.push(
|
||||||
attrPos[i * 3],
|
attrPos[i * 3],
|
||||||
attrPos[i * 3 + 1],
|
attrPos[i * 3 + 1],
|
||||||
attrPos[i * 3 + 1],
|
attrPos[i * 3 + 2],
|
||||||
attrDistance[i],
|
attrDistance[i],
|
||||||
miters[i],
|
miters[i],
|
||||||
totalDistance,
|
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 { GaodeMap } from '@antv/l7-maps';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
@ -19,7 +19,8 @@ export default class MultiPolygon extends React.Component {
|
||||||
|
|
||||||
public async componentDidMount() {
|
public async componentDidMount() {
|
||||||
const response = await fetch(
|
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({
|
const scene = new Scene({
|
||||||
id: 'map',
|
id: 'map',
|
||||||
|
@ -27,13 +28,16 @@ export default class MultiPolygon extends React.Component {
|
||||||
pitch: 0,
|
pitch: 0,
|
||||||
style: 'dark',
|
style: 'dark',
|
||||||
center: [121.775374, 31.31067],
|
center: [121.775374, 31.31067],
|
||||||
zoom: 14.1,
|
zoom: 5,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
const data = await response.json();
|
||||||
const layer = new PolygonLayer({})
|
// console.log(data.features[5]);
|
||||||
.source(await response.json())
|
// data.features = data.features.slice(6);
|
||||||
.shape('fill')
|
const layer = new LineLayer()
|
||||||
|
.source(data)
|
||||||
|
.shape('line')
|
||||||
|
.size(1)
|
||||||
.color('red')
|
.color('red')
|
||||||
.style({
|
.style({
|
||||||
opacity: 1.0,
|
opacity: 1.0,
|
||||||
|
|
Loading…
Reference in New Issue