UI rendering corrections and constrained angles feature #12
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 added a new feature where users can hold down 'Shift' to constrain angles to 45-degree increments. This is especially helpful for some special cases where lines are often vertical or horizontal. I also fixed a lot of rendering bugs. For example, previously, the 'Clear all polygons' feature caused polygons/lines to change color upon closure. Additionally, I changed the rendering order so that shapes being drawn appear above rather than below the existing shapes. I also changed the order so that the polygon fill is not drawn over the lines, and the lines are not drawn over the nodes. Previously, the lines were drawn in the same color until a polygon was drawn and then lines would be drawn in the next color in the queue. Now each line is drawn in a new color. Previously the nodes were not drawn on the canvas until the mouse moved, but now they are drawn as soon as the user clicks. And lastly, I changed the lineJoin type to be bevel instead of miter because small angles could cause ugly sharp points that extended beyond the nodes.
Type of change
Please delete options that are not relevant.
How has this change been tested, please provide a testcase or example of how you tested the change?
I tested this manually by using Safari and Chrome.
Any specific deployment considerations
No.