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

Fix toggle behaviour of the Select interaction #2243

Closed
wants to merge 3 commits into from

Conversation

ahocevar
Copy link
Member

Because features on overlays are skipped and therefore not seen by forEachFeatureAtPixel, it is not possible to toggle the selection of a skipped feature. By making the skipped features for forEachFeatureAtPixel configurable at the map renderer level, the Select interaction can do its hit detection without excluding the skipped features of its selection overlay.

The issue was reported on the mailing list, and this is a solution that works independently of #1591.

By not taking the skipped features from the frameState, we achieve the
flexibility of doing forEachFeatureAtPixel at the map renderer level
with a custom set of skipped features.
@elemoine
Copy link
Member

The problem with this approach is that the features will be rendered in the hit detection canvas using the layer's styles. Think about a icon whose size doubles when the feature is selected. Is waiting for #1591 a problem for you? I can put together a PR tomorrow.

@ahocevar
Copy link
Member Author

Good point. This is an urgent issue for a client of ours. With #1591, how will you trigger hit detection for features on overlays? By implementing a forEachFeatureAtPixel method on ol.FeatureOverlay? I don't think that including them in map.forEachFeatureAtPixel will be a good idea, because then the purpose of layerFilter gets confusing.

@elemoine
Copy link
Member

Not by implementing forEachFeatureAtPixel in ol.FeatureOverlay, but, yes, reusing the map.forEachFeatureAtPixel API. For features drawn by feature overlays the callback will be passed a null value for layer. And the layerFilter will obviously have no effect – features of feature overlays will always be detected. Do you think that's a problem?

@ahocevar
Copy link
Member Author

Not sure. At least it will be confusing and needs to be well documented.

@elemoine
Copy link
Member

@ahocevar this is my branch: https://github.com/elemoine/ol3/compare/replaygroup. It is not complete but it should show you how it is implemented.

@ahocevar
Copy link
Member Author

#2254 fixes this, so closing.

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

2 participants