Is there interest in adding more condition flexibility to the Modify Interaction?

9 views
Skip to first unread message

Matthew Rutherford

unread,
Jun 23, 2019, 2:40:27 AM6/23/19
to OpenLayers Dev
Hi All,

Is there an easier way to implement this functionality short of remaking my own version of the Modify Interaction, or extending it?
if Not
Would there be interest in adding some functionality like the following to the Modify Interaction? On all the conditional options in a Modify Interaction, add a new integer index parameter that describes the point about to be edited, or the segment about to get inserted on. I would be fine with trying to make a PR for this.

I want to provide functionality for the user to edit a`LineString` so that has certain points can't be moved, and/or deleted, and has certain segments that can't be inserted on, and I have not been able to find an easy to do this yet using the Modify Interaction.
So far I have checked if I could add this functionality by using the `condition`, `deleteCondition`, and `insertVertexCondition` options, but the only thing that gets passed to those functions is a standard `MapBrowserEvent`. Which I could use to pick which thing is being edited, but it wouldn't be guaranteed to match what the Modify Interaction picks, so I started looking at the Modify Interaction Source code, and found that the Modify Interaction private variables `vertexFeature_`, `rBush_`, and `dragSegments_`  have the data I need, unfortunately they are not defined when any of the condition functions above gets called.  So I wrote some prototype code to override some Modify functions to do a condition check later on in the execution after those private variables got populated.

Thanks,
Matt


Also I see in the title/header of this group is for openlayers 3. Is that still the case, is there an openlayers 5 group, or has it just not been updated?
Reply all
Reply to author
Forward
0 new messages