8000 fix fgblayer sourceid 冲突导致报错 · SuperMap/iClient-JavaScript@ec2e084 · GitHub
[go: up one dir, main page]

Skip to content

Commit ec2e084

Browse files
fix fgblayer sourceid 冲突导致报错
1 parent 9057e88 commit ec2e084

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/mapboxgl/overlay/FGBLayer.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export class FGBLayer {
6060
constructor(options = {}) {
6161
this.id = options.layerID ? options.layerID : CommonUtil.createUniqueID('FGBLayer_');
6262
this.layerId = this.id + 'outer';
63-
this.sourceId = this.layerId;
63+
this._sourceId = this.layerId;
6464
this.options = options;
6565
this.strategy = options.strategy || 'bbox';
6666
this.url = options.url;
@@ -131,20 +131,20 @@ export class FGBLayer {
131131
async _handleFeatures(bounds) {
132132
let iter = await this.renderer._loadData(bounds);
133133
const features = await this.renderer.iterateFeatures(iter);
134-
if (!this.map.getSource(this.sourceId)) {
135-
this.map.addSource(this.sourceId, {
134+
if (!this.map.getSource(this._sourceId)) {
135+
this.map.addSource(this._sourceId, {
136136
type: 'geojson',
137137
data: features
138138
});
139139
} else {
140-
this.map.getSource(this.sourceId).setData(features);
140+
this.map.getSource(this._sourceId).setData(features);
141141
}
142142
if (!this.map.getLayer(this.layerId)) {
143143
this.layerType = this.renderer.layerType;
144144
const layer = Object.assign({
145145
id: this.layerId,
146146
type: this.layerType,
147-
source: this.sourceId,
147+
source: this._sourceId,
148148
paint: Object.assign(PAINT_MAP[this.layerType], this.options.paint) || {},
149149
layout: this.options.layout || {}
150150
});
@@ -161,7 +161,7 @@ export class FGBLayer {
161161
if (!alreadyLoaded) {
162162
let iter = await this.renderer._loadData(extentToLoad);
163163
const features = await this.renderer.iterateFeatures(iter);
164-
this.map.getSource(this.sourceId).setData(features);
164+
this.map.getSource(this._sourceId).setData(features);
165165
}
166166
}
167167
}

0 commit comments

Comments
 (0)
0