Skip to content

Commit 13b2b41

Browse files
yhy0217prushforth
authored andcommitted
fix the bug that the native zoom of feature is not properly set when map-meta[name=zoom] does not specify a value
1 parent 875453b commit 13b2b41

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

src/map-feature.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -303,29 +303,7 @@ export class MapFeature extends HTMLElement {
303303
}
304304
return { zoom: nativeZoom, cs: nativeCS };
305305
} else {
306-
// feature attaches to layer- or layer-'s shadow
307-
if (content.nodeType === Node.DOCUMENT_NODE) {
308-
// for features migrated from mapml, read native zoom and cs from the remote mapml
309-
return M.getNativeVariables(content);
310-
} else if (content.nodeName.toUpperCase() === 'LAYER-') {
311-
// for inline features, read native zoom and cs from inline map-meta
312-
let zoomMeta = this._parentEl.querySelectorAll('map-meta[name=zoom]'),
313-
zoomLength = zoomMeta?.length;
314-
nativeZoom = zoomLength
315-
? +zoomMeta[zoomLength - 1]
316-
.getAttribute('content')
317-
?.split(',')
318-
.find((str) => str.includes('value'))
319-
?.split('=')[1]
320-
: 0;
321-
322-
let csMeta = this._parentEl.querySelectorAll('map-meta[name=cs]'),
323-
csLength = csMeta?.length;
324-
nativeCS = csLength
325-
? csMeta[csLength - 1].getAttribute('content')
326-
: 'gcrs';
327-
return { zoom: nativeZoom, cs: nativeCS };
328-
}
306+
return M.getNativeVariables(content);
329307
}
330308
}
331309

0 commit comments

Comments
 (0)