Skip to content

Conversation

@MrLynx93
Copy link
Contributor

@MrLynx93 MrLynx93 commented Oct 7, 2024

Allow to pass in filter and layers parameter to Translate interaction. Layers are used in Translate.handleMoveEvent (passed in as this.layerFilter_ to map.forEachFeatureAtPixel

@MrLynx93 MrLynx93 changed the title #16261: Allow to pass in filter and layers parameter to Translate interaction Issue #16261: Allow to pass in filter and layers parameter to Translate interaction Oct 7, 2024
@github-actions
Copy link

github-actions bot commented Oct 7, 2024

📦 Preview the website for this branch here: https://deploy-preview-16262--ol-site.netlify.app/.

@ahocevar
Copy link
Member

ahocevar commented Oct 7, 2024

Thanks for your contribution, @MrLynx93. I think something is wrong here: The pull request title makes sense, but it is already possible to combine layers and filter. Your change here changes things so it is possible to combine layers/filter with features, which would not work.

By the way, using a features collection would probably be a good way to fix your problem in #16261. If there is something to improve the Translate interaction, it would be to make it work with a source as an alternative to features, like the Draw, Modify and Snap interactions do.

@MrLynx93
Copy link
Contributor Author

MrLynx93 commented Oct 7, 2024

Thanks for the quick response @ahocevar . My problem is that I do pass in features and layers both. But layers are ignored because of this line: if (options.layers && !this.features_) which assigns layerFilter_ only if you didn't pass in features.
I edited the title of this pull request to make this more clear.

@MrLynx93 MrLynx93 changed the title Issue #16261: Allow to pass in filter and layers parameter to Translate interaction Issue #16261: Allow to pass in both features and layers parameters Translate interaction Oct 7, 2024
@ahocevar
Copy link
Member

ahocevar commented Oct 7, 2024

So what's the point of using both features and layers? Why don't you just pass features, e.g. from a source you created with useSpatialIndex: false?

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.

2 participants