Skip to content

Commit 875453b

Browse files
yhy0217prushforth
authored andcommitted
fix the bug that missing map-properties affects the bahavior of map-feature with link
1 parent 992beb6 commit 875453b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mapml/features/geometry.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ export var Geometry = L.FeatureGroup.extend({
1414
L.LayerGroup.prototype.initialize.call(this, layers, options);
1515
this._featureEl = this.options.mapmlFeature;
1616

17+
let firstLayer = layers[Object.keys(layers)[0]];
18+
if (layers.length === 1 && firstLayer.options.link)
19+
this.options.link = firstLayer.options.link;
1720
if (
1821
(this.options.onEachFeature && this.options.properties) ||
1922
this.options.link
2023
) {
2124
L.DomUtil.addClass(this.options.group, 'leaflet-interactive');
22-
let firstLayer = layers[Object.keys(layers)[0]];
23-
if (layers.length === 1 && firstLayer.options.link)
24-
this.options.link = firstLayer.options.link;
2525
if (this.options.link) {
2626
M.Path.prototype.attachLinkHandler.call(
2727
this,

0 commit comments

Comments
 (0)