Fix 613 - Delete feature vertex on right click with menu #4251
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requires #4244 to be merged first.This patch changes the way vertice can be removed from a feature.
Originally
The original behaviour was: on left click, delete the vertex immediately. This is the default behaviour in OpenLayers.
From now on
This behaviour has been changed to two ways:
Delete vertex
item that, when clicked, deletes the vertexApproval required The first behaviour was not originally specifically asked. It is a suggestion on my end for avanced users that are used to clicking on the vertice directly to remove them.
Affected tools
Technicallities
The way the detection of a vertex work is this: upon hitting a feature with the
contextual
menu event, we ask the ngeo featureHelper module to detect if the event occured on top of a vertex. The style of the vertex is used alongside the current resolution of the map view to return a buffered extent around each vertex of the feature.If one of these extents contains the location where the event occured, that's a vertex hit. When that happens, we keep the indexes of the coordinate that hit to be able to delete it later.
The FeatureHelper has 2 new methods to help us in this way:
getVertexInfoAtCoordinate
removeVertex