Skip to content

Commit

Permalink
Merge pull request #1350 from Esri/fix-1348
Browse files Browse the repository at this point in the history
Add special openPopup and openTooltip methods to FeatureLayer
  • Loading branch information
gavinr authored Jan 11, 2023
2 parents 59c8581 + bedb15f commit e5fe79a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/Layers/FeatureLayer/FeatureLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,36 @@ export var FeatureLayer = FeatureManager.extend({
if (layer && layer.setStyle && this.options.style) {
this.resetFeatureStyle(geojson.id);
}
},

// This is the same as the Layer.openPopup method except it excludes the `FeatureGroup`
// logic to work around https://github.com/Leaflet/Leaflet/issues/8761
openPopup (latlng) {
if (this._popup) {
if (this._popup._prepareOpen(latlng || this._latlng)) {
// open the popup on the map
this._popup.openOn(this._map);
}
}
return this;
},

// This is the same as the `Layer.openTooltip` method except it excludes the `FeatureGroup`
// logic to work around https://github.com/Leaflet/Leaflet/issues/8761
openTooltip (latlng) {
if (this._tooltip) {
if (this._tooltip._prepareOpen(latlng)) {
// open the tooltip on the map
this._tooltip.openOn(this._map);

if (this.getElement) {
this._setAriaDescribedByOnLayer(this);
} else if (this.eachLayer) {
this.eachLayer(this._setAriaDescribedByOnLayer, this);
}
}
}
return this;
}
});

Expand Down

0 comments on commit e5fe79a

Please sign in to comment.