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

Fix 613 - Delete feature vertex on right click with menu #4251

Merged
merged 2 commits into from Sep 19, 2018

Conversation

adube
Copy link
Contributor

@adube adube commented Sep 18, 2018

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:

  1. on left click + ctrl (cmd on Mac), delete the vertex immediately.
  2. on right click, show a menu with the Delete vertex item that, when clicked, deletes the vertex

Approval 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

  • GMF drawing tool (a.k.a. redlining)
  • GMF editing tool

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

@adube adube requested a review from fredj September 18, 2018 17:50
src/misc/FeatureHelper.js Outdated Show resolved Hide resolved
src/misc/FeatureHelper.js Outdated Show resolved Hide resolved
@adube adube changed the title WIP Fix 613 - Delete feature vertex on right click with menu Fix 613 - Delete feature vertex on right click with menu Sep 19, 2018
@adube
Copy link
Contributor Author

adube commented Sep 19, 2018

@fredj Fixes applied and rebased onto master.

Copy link
Member

@fredj fredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very good to me.
Let's merge with the ctrl click to delete. If needed, we can revisit this behavior later

@adube
Copy link
Contributor Author

adube commented Sep 19, 2018

Excellent, thank you very much for the review.

@adube adube merged commit d28581e into camptocamp:master Sep 19, 2018
@adube adube deleted the v2_4-613-delete-vertex-menu branch September 19, 2018 14:54
@sbrunner sbrunner added this to the 2.4 milestone Oct 30, 2018
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