mirror of https://gitee.com/antv-l7/antv-l7
fix(react): 更新数据源之后是否需要自适应配置项开启
This commit is contained in:
parent
2686c48881
commit
7167c3197e
|
@ -60,10 +60,6 @@ export default function BaseLayer(type: string, props: ILayerProps) {
|
|||
// 重绘layer
|
||||
if (layer) {
|
||||
mapScene.render();
|
||||
// 如果autoFit为true,执行自适应操作
|
||||
if (options?.autoFit) {
|
||||
layer.fitBounds();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -17,6 +17,11 @@ export default React.memo(function Chart(props: ISourceProps) {
|
|||
} else {
|
||||
layer.setData(data, sourceOption);
|
||||
}
|
||||
// 临时解决:若开启,每次更新之后自适应缩放;
|
||||
// TODO:是否可以统一到Layer的option里,目前问题是Layer的autoFit一直为true,无法触发更新
|
||||
if (sourceOption.autoFit) {
|
||||
layer.fitBounds();
|
||||
}
|
||||
}, [data, JSON.stringify(sourceOption)]);
|
||||
return null;
|
||||
});
|
||||
|
|
|
@ -49,6 +49,8 @@ export interface IStyleOptions {
|
|||
|
||||
export interface ISourceOptions extends ISourceCFG {
|
||||
data: any;
|
||||
// 每次更新数据之后是否自适应缩放
|
||||
autoFit: boolean;
|
||||
}
|
||||
|
||||
export interface IActiveOptions {
|
||||
|
|
Loading…
Reference in New Issue