mirror of https://gitee.com/antv-l7/antv-l7
fix: 修复 shape 更新失效 (#1547)
Co-authored-by: shihui <yiqianyao.yqy@alibaba-inc.com>
This commit is contained in:
parent
55ae0001c9
commit
debd0bff41
|
@ -51,26 +51,31 @@ export default () => {
|
|||
.active(false)
|
||||
.size(20);
|
||||
scene.addLayer(imageLayer);
|
||||
imageLayer.on('mousedown', (e) => {
|
||||
console.log('mousedown', e);
|
||||
});
|
||||
const popup = new Popup({
|
||||
});
|
||||
|
||||
scene.addPopup(popup);
|
||||
imageLayer.on('click', (e) => {
|
||||
console.log(e)
|
||||
const {lng,lat} = e.lngLat
|
||||
setTimeout(() => {
|
||||
imageLayer.shape('02');
|
||||
scene.render();
|
||||
}, 4000)
|
||||
// imageLayer.on('mousedown', (e) => {
|
||||
// console.log('mousedown', e);
|
||||
// });
|
||||
// const popup = new Popup({
|
||||
// });
|
||||
|
||||
popup.setOptions({
|
||||
title: e.feature.name,
|
||||
html:e.feature.name,
|
||||
lngLat: {
|
||||
lng,
|
||||
lat,
|
||||
},
|
||||
});
|
||||
});
|
||||
// scene.addPopup(popup);
|
||||
// imageLayer.on('click', (e) => {
|
||||
// console.log(e)
|
||||
// const {lng,lat} = e.lngLat
|
||||
|
||||
// popup.setOptions({
|
||||
// title: e.feature.name,
|
||||
// html:e.feature.name,
|
||||
// lngLat: {
|
||||
// lng,
|
||||
// lat,
|
||||
// },
|
||||
// });
|
||||
// });
|
||||
|
||||
}, []);
|
||||
return (
|
||||
|
|
|
@ -13,11 +13,11 @@ const shapeUpdateList = [
|
|||
['rhombus', 'cylinder'],
|
||||
['vesica', 'cylinder'],
|
||||
];
|
||||
export function updateShape(
|
||||
export async function updateShape(
|
||||
layer: ILayer,
|
||||
lastShape: StyleAttributeField | undefined,
|
||||
currentShape: StyleAttributeField | undefined,
|
||||
): void {
|
||||
) {
|
||||
if (
|
||||
typeof lastShape === 'string' &&
|
||||
typeof currentShape === 'string' &&
|
||||
|
@ -25,13 +25,17 @@ export function updateShape(
|
|||
) {
|
||||
if (layer.type === 'PointLayer') {
|
||||
layer.dataState.dataSourceNeedUpdate = true;
|
||||
await layer.hooks.beforeRenderData.promise();
|
||||
layer.renderLayers();
|
||||
return;
|
||||
}
|
||||
|
||||
shapeUpdateList.map((shapes) => {
|
||||
shapeUpdateList.map(async (shapes) => {
|
||||
if (shapes.includes(lastShape) && shapes.includes(currentShape)) {
|
||||
// dataSourceNeedUpdate 借用数据更新时更新 layer model 的工作流
|
||||
layer.dataState.dataSourceNeedUpdate = true;
|
||||
await layer.hooks.beforeRenderData.promise();
|
||||
layer.renderLayers();
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue