ol2 icon indicating copy to clipboard operation
ol2 copied to clipboard

Provide the vertex index in the ModifyFeatureControl / Vector "vertexremoved" event.

Open mmacfadden opened this issue 11 years ago • 1 comments

Currently, the vertexremoved event contains the feature, vertex, and pixel of the removed vertex. This information is not sufficient to determine where the vertex that was removed "was" in the parent geometry. We need to know the position within the parent geometry that the vertex occupied prior to it being removed. The point is removed before the event is fired, so there is now way to interrogate the data to determine the position.

I see three options to provide this functionality:

  1. Fire the event before the vertex is removed.
  2. Fire a new event "beforevertexremoved".
  3. Add the old index to the current event.

Option #1 is not acceptable since many applications may depend on the current event being fired after the removal.

Option #2 seems to be less risky, but adds another event that is probably hyper-specific to this scenario, and could muddy the API.

Option #3 is a good options since it does not affect the current API and is backwards compatible. It can also be implemented in about 3 lines of code.

I plan on submitting a pull request implementing Option #3 for community review.

mmacfadden avatar Nov 25 '14 19:11 mmacfadden

After looking at the pull request some more. This works well if you have a simple polygon. I actually need to check the index in the parent geometry instead of looking for the index in the vertices. I will upload another pull request.

mmacfadden avatar Nov 26 '14 19:11 mmacfadden