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

Replace layers option from ol.interaction.SelectOptions #2081

Closed
wants to merge 1 commit into from

Conversation

fredj
Copy link
Member

@fredj fredj commented May 16, 2014

Replace the 'layers' function with a 'filter' function to be able
to filter the features that will be added to the selection.

work in progress

Replace the 'layers' function with a 'filter' function to be able
to filter the features that will be added to the selection.
@tschaub
Copy link
Member

tschaub commented May 16, 2014

The simplest use case is providing a single layer for selection. Currently this is supported as below:

  layers: [layer]

It looks like your work here would change this to the following:

  filter: function(feature, candidate) {
    return candidate === layer;
  }

Couldn't this same functionality be accomplished by adding a second feature arg to the current layers function? So the layers option would be (Array.<ol.layer.Layer>|function(ol.layer.Layer, ol.Feature): boolean|undefined).

@elemoine
Copy link
Member

Discussed with @fredj and closing for now.

@elemoine elemoine closed this May 22, 2014
@tschaub
Copy link
Member

tschaub commented May 22, 2014

Curious to hear what you guys discussed. I imagine this could be useful functionality. I understand that it would be awkward to have a filter function named layers that accepted a layer and feature (the name filter does fit that better). If we want flexibility and convenience, we could accept either a layers array or a filter function.

Didn't mean for my comments to shut this effort down, so please reopen if you want to continue discussing.

@elemoine
Copy link
Member

@fredj was trying to use a draw interaction and a select interaction at the same time. That did not work as expected because after drawing a point that point was immediately selected by the select interaction (which works on singleclick by default). @fredj thought that he could address that problem by preventing certain features from being selected by the select interaction. After discussion we realized that using a draw interaction and a select interaction together was not a good approach for @fredj's use-case. So we just closed this issue for now. But it does not mean this is not useful functionality to have eventually.

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

3 participants