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

Enhance Popup/Tooltip content handling for FeatureGroup #6651

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

johnd0e
Copy link
Collaborator

@johnd0e johnd0e commented May 9, 2019

Allow content function to return undefined: in this case Popup/Tooltip is not shown (and is closed if was already opened).

Note: This is based on #7540 (adds a single commit)


As said in docs to FeatureGroup (and thus GeoJSON, as it extends FeatureGroup), bindPopup binds a popup to all of the layers at once (likewise with bindTooltip).

And what is implied (but not said explicitly) - function must return value for every layer (otherwise we get exception).

But in my practice it's more common when only some of layers need Popup/Tooltip.
This PR adds such possibility.


This change is Reviewable

@johnd0e johnd0e force-pushed the enhance-content-function branch 2 times, most recently from 686d2d7 to eb56a19 Compare March 30, 2021 13:26
@johnd0e johnd0e marked this pull request as draft March 30, 2021 13:26
@johnd0e johnd0e changed the title Enhance Popup/Tooltip content function handling Enhance Popup/Tooltip content handling for FeatureGroup Mar 30, 2021
@johnd0e johnd0e force-pushed the enhance-content-function branch 2 times, most recently from eaa3b31 to 1618722 Compare April 3, 2021 15:11
In this case Popup/Tooltip is not shown (and is closed if was already opened).

Useful when only some layers in FeatureGroup/GeoJSON need popups:
- previously: it was necessary to attach independent popups to each sublayer
- now: it's enough to have common content function attached to parent FeatureGroup
@johnd0e
Copy link
Collaborator Author

johnd0e commented Nov 1, 2021

@mourner
Should new behavior be documented explicitly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant