Feature to editMode: Add and Delete nodes #22
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.
Description
I've used the application and I've noticed that I didn't have the possibility of adding or deleting nodes from a created polygon, I found it an interesting addition that can improve the user experience so I worked on it.
I've added these changes to the editing mode, first I added a check on the letter ctrl to the mousedown event, if it's pressed and a node is clicked, it adds a new one. To achieve this I identify the current node and the next one, then I calculate the distance between them and add the node in the center, once this is done I redraw the lines to connect them and update the canvas.
Then I have added a check on the alt key, if it is pressed and you click on a node, it deletes it
Type of change
How has this change been tested, please provide a testcase or example of how you tested the change?
I tested it on several ways running with live server and I've ensured the previous functinalities of the editMode still works.
Any specific deployment considerations
None that I can think of
Docs