I'm using a select interaction. I can filter the layers which are selectable using a filter function as the layers
option key. I want to also filter which features are selectable.
The documentation says "Which features are selected is determined by the condition
option". I am therefore trying to write a function for the condition
option which can filter out particular features. But I'm not sure it's possible. I think the quoted documentation may be misleading.
The condition
function takes an event argument. I first filter out any events which aren't of the click
type, but then I want to filter on features. The event has a target
property, but it's not clear to me what this is pointing to. It doesn't appear to be a layer or a feature.
I do have the pixel coordinates and the map coordinates at the clicked point. I could use either of these to loop over features at that point in the layer and, if I deem one of them selectable, return true. But what if there are two overlapping features, one of which I want to be selectable and one not?
I'm guessing this condition
option is not what I'm looking for, since it is run once per event, not once per possible feature. Is there a way to achieve what I'm looking for?