Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add special openPopup and openTooltip methods to FeatureLayer #1350

Merged
merged 1 commit into from
Jan 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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