fix: 修复 MaskTile 失效 (#1471)

Co-authored-by: shihui <yiqianyao.yqy@alibaba-inc.com>
This commit is contained in:
YiQianYao 2022-11-12 10:12:00 +08:00 committed by GitHub
parent acef404204
commit b54f14f0b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -20,12 +20,19 @@ export default class MaskTile extends Tile {
await this.addLayer(layer); await this.addLayer(layer);
this.isLoaded = true; this.isLoaded = true;
} }
public getFeatures(sourceLayer: string | undefined){
if(!sourceLayer) return [];
const source = this.sourceTile.data;
return source.getTileData(sourceLayer);
}
protected getSourceOption() { protected getSourceOption() {
const rawSource = this.parent.getSource(); const rawSource = this.parent.getSource();
const { sourceLayer, featureId } = this.parent.getLayerConfig<{ const { sourceLayer, featureId } = this.parent.getLayerConfig<{
featureId: string; featureId: string;
}>(); }>();
const features = this.getFeatures(sourceLayer) const features = this.getFeatures(sourceLayer);
return { return {
data: { data: {
type: 'FeatureCollection', type: 'FeatureCollection',