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

Small issue with clusters #48

Open
diogogmatos opened this issue Jul 28, 2022 · 0 comments
Open

Small issue with clusters #48

diogogmatos opened this issue Jul 28, 2022 · 0 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@diogogmatos
Copy link
Member

Notice how this one pin won't join the cluster of the rest of the pins nearby? This happens because the <MarkerClusterGroup> can only have a list of markers (<Marker>) inside, which conflicts with the filter-by-type feature we created. So what ends up happening is that pins are grouped into clusters of their respective type only.
Putting all the pins inside a <MarkerClusterGroup> separately doesn't work because it duplicates the pins, only without putting them into Layer Groups. How could we solve this?

image

This is how we're applying the MarkerClusterGroup currently:

function filterPins(pins: Pin[], { name, type, checked }: Filter) {
  return (
    <LayersControl.Overlay checked={checked} name={name}>
      <LayerGroup>
        <MarkerClusterGroup
          iconCreateFunction={createClusterCustomIcon}
          showCoverageOnHover={false}
        >
          {pins
            .filter((pin: Pin) => pin.type === type)
            .map((pin: Pin) => (
              <Marker key={`${pin.coordinates}-${pin.author}`} {...pin} />
            ))}
        </MarkerClusterGroup>
      </LayerGroup>
    </LayersControl.Overlay>
  );
}
@diogogmatos diogogmatos added the help wanted Extra attention is needed label Jul 28, 2022
@diogogmatos diogogmatos self-assigned this Jul 28, 2022
@nelsonmestevao nelsonmestevao added the bug Something isn't working label Aug 18, 2022
@ruilopesm ruilopesm reopened this Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants