Merge pull request #418 from antvis/fix-source

fix(source): 获取选中数据数据被修改的bug
This commit is contained in:
@thinkinggis 2020-06-30 15:21:51 +08:00 committed by GitHub
commit 4f49a88470
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -128,13 +128,14 @@ export default class Source extends EventEmitter {
id < this.originData.features.length
? this.originData.features[id]
: 'null';
const newFeature = cloneDeep(feature);
if (this.transforms.length !== 0) {
const item = this.data.dataArray.find((dataItem: IParseDataItem) => {
return dataItem._id === id;
});
feature.properties = item;
newFeature.properties = item;
}
return feature;
return newFeature;
} else {
return id < this.data.dataArray.length ? this.data.dataArray[id] : 'null';
}