mirror of https://gitee.com/antv-l7/antv-l7
commit
e6c9e461e8
|
@ -225,13 +225,13 @@ export default class StyleAttributeService implements IStyleAttributeService {
|
|||
verticesForCurrentFeature.length / vertexSize;
|
||||
|
||||
// 记录三角化结果,用于后续精确更新指定 feature
|
||||
// this.featureLayout.sizePerElement = size;
|
||||
// this.featureLayout.elements.push({
|
||||
// featureIdx,
|
||||
// vertices: verticesForCurrentFeature,
|
||||
// normals: normalsForCurrentFeature as number[],
|
||||
// offset: verticesNum,
|
||||
// });
|
||||
this.featureLayout.sizePerElement = size;
|
||||
this.featureLayout.elements.push({
|
||||
featureIdx,
|
||||
vertices: verticesForCurrentFeature,
|
||||
normals: normalsForCurrentFeature as number[],
|
||||
offset: verticesNum,
|
||||
});
|
||||
|
||||
verticesNum += verticesNumForCurrentFeature;
|
||||
// 根据 position 顶点生成其他顶点数据
|
||||
|
|
|
@ -123,41 +123,27 @@ export default class TextLayerDemo extends React.Component {
|
|||
});
|
||||
scene.on('loaded', () => {
|
||||
const layer = new PolygonLayer({})
|
||||
.source({
|
||||
type: 'FeatureCollection',
|
||||
features: [],
|
||||
})
|
||||
.shape('extrude')
|
||||
.source(data)
|
||||
.shape('fill')
|
||||
.scale('childrenNum', {
|
||||
type: 'quantile',
|
||||
})
|
||||
.size('childrenNum', [10, 100000000])
|
||||
// .color('red')
|
||||
// .color('childrenNum', [
|
||||
// '#D92568',
|
||||
// '#E3507E',
|
||||
// '#FC7AAB',
|
||||
// '#F1D3E5',
|
||||
// '#A7B5E3',
|
||||
// '#F2EEFF',
|
||||
// ])
|
||||
.color('childrenNum*name', (childrenNum, name) => {
|
||||
console.log(childrenNum, name);
|
||||
return 'red';
|
||||
})
|
||||
.color('childrenNum', [
|
||||
'#D92568',
|
||||
'#E3507E',
|
||||
'#FC7AAB',
|
||||
'#F1D3E5',
|
||||
'#A7B5E3',
|
||||
'#F2EEFF',
|
||||
])
|
||||
.style({
|
||||
opacity: 1.0,
|
||||
});
|
||||
scene.addLayer(layer);
|
||||
setTimeout(() => {
|
||||
layer.setData(data);
|
||||
console.log('update');
|
||||
}, 2000);
|
||||
layer.on('click', (e) => {
|
||||
console.log(e);
|
||||
});
|
||||
this.scene = scene;
|
||||
|
||||
layer.on('remapping', ()=>{
|
||||
console.log('remapinbg event')
|
||||
});
|
||||
const gui = new dat.GUI();
|
||||
this.gui = gui;
|
||||
const styleOptions = {
|
||||
|
@ -206,6 +192,7 @@ export default class TextLayerDemo extends React.Component {
|
|||
])
|
||||
.onChange((color: any) => {
|
||||
layer.color('childrenNum', RMBColor[color] as string[]);
|
||||
// layer.shape('fill');
|
||||
scene.render();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue