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

RFeature onClick doesn't work inside RLayerCluster #143

Closed
macaframaretard opened this issue Mar 22, 2023 · 5 comments
Closed

RFeature onClick doesn't work inside RLayerCluster #143

macaframaretard opened this issue Mar 22, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@macaframaretard
Copy link

RFeature onClick doesn't work inside RLayerCluster

Example

  <RLayerCluster
          distance={distance}
          ref={clusterLayerRef}
          zIndex={1000}
          style={(feature, resolution) =>
            getClusterStyle(feature, resolution, featuresOriginalData)
          }
        >
          {featuresArray.map((f: Feature, index) => {
            return (
              <RFeature
                feature={f}
                key={index}
                onClick={() => console.log(index)}
              />
            );
          })}
        </RLayerCluster>
@mmomtchev
Copy link
Owner

Yes, I confirm, currently this is not supported.

@mmomtchev mmomtchev added the enhancement New feature or request label Mar 22, 2023
@macaframaretard
Copy link
Author

@mmomtchev so, how i can use RPopup inside RLayerCluster?

@mmomtchev
Copy link
Owner

The problem is that individual features in a cluster layer might not be visible. You will have to attach your popup to the super-feature and there are lots of special cases to handle. Is this what you want, attach your popup to the cluster?

@macaframaretard
Copy link
Author

I want to attach one type of popups to super-feature(is superfeature cluster of features?) and attach another popups to features. I've tried, but trigger doesn't work

@mmomtchev
Copy link
Owner

If you attach an onClick handler to the cluster layer itself, it should get called when clicking on clusters. However will be passed the super-feature, not individual features.

Being able to call the onClick handler of individual features is probably useful and I will consider adding it.

However popups will be more difficult as these will have to be merged.

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

No branches or pull requests

2 participants