mirror of https://gitee.com/antv-l7/antv-l7
fix: 修复 option 参数未同步 style 更新导致的配置失效 (#1226)
* feat: 去处事件节流 * fix: 修复 option 参数未同步 style 更新导致的配置失效 * style: lint style
This commit is contained in:
parent
0df9edfbb5
commit
ef683c9142
|
@ -246,6 +246,9 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
|||
public updateLayerConfig(
|
||||
configToUpdate: Partial<ILayerConfig | ChildLayerStyleOptions>,
|
||||
) {
|
||||
// 同步 options 记录
|
||||
this.updateRawConfig(configToUpdate);
|
||||
|
||||
if (!this.inited) {
|
||||
this.needUpdateConfig = {
|
||||
...this.needUpdateConfig,
|
||||
|
@ -1312,6 +1315,18 @@ export default class BaseLayer<ChildLayerStyleOptions = {}>
|
|||
return {};
|
||||
}
|
||||
|
||||
private updateRawConfig(
|
||||
configToUpdate: Partial<ILayerConfig | ChildLayerStyleOptions>,
|
||||
) {
|
||||
Object.keys(configToUpdate).map((key) => {
|
||||
// @ts-ignore
|
||||
if (this.rawConfig[key] && this.rawConfig[key] !== configToUpdate[key]) {
|
||||
// @ts-ignore
|
||||
this.rawConfig[key] = configToUpdate[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private sourceEvent = () => {
|
||||
this.dataState.dataSourceNeedUpdate = true;
|
||||
const { autoFit, fitBoundsOptions } = this.getLayerConfig();
|
||||
|
|
Loading…
Reference in New Issue