Fixes to shape drawing #955
Merged
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.
Fixes #733
I had discovered what caused bug #733 was that "-" and "" are treated differently by the dash engine. So it wasn't noticeable at lower widths, but at larger widths it would cause those artifacts. This fix defaults the "-" dash pattern to "" internally, preventing this issue and drawing it as the user expects.
This approach may be considered a little too hacky? An alternative would be to make the default dashpattern "".
However, this led to a second issue, was that the polygon engine auto-defaults to use
LineCap.Square. This would produce another artifact in drawing the circle. Defaulting to LineCap.Butt would fix this issue, but it would break rectangle drawing, and hard-coding in to make an exception for ellipse drawing would suck.So i modified the polygon engine to support each shape drawing tool defining its own linecap. Ellipse tool uses Butt, Rectangle tool uses Square, and Rounded Rectangle uses Butt. Using any dashpattern other than "-" enforces square because dash patterns don't work with butt.
Before dashpattern fix:


After dashpattern fix:
Final result:
And dash patterns still work.