added optional open/close parameter to startNewSubPath#11
Open
Hannobal wants to merge 2 commits intoadishavit:masterfrom
Open
added optional open/close parameter to startNewSubPath#11Hannobal wants to merge 2 commits intoadishavit:masterfrom
Hannobal wants to merge 2 commits intoadishavit:masterfrom
Conversation
adishavit
reviewed
Oct 14, 2021
simple_svg_1.0.0.hpp
Outdated
| struct SubPath { | ||
| SubPath(bool close) : close(close) {}; | ||
| std::vector<Point> elements; | ||
| bool close = true; |
Owner
There was a problem hiding this comment.
Rename close to closed or isClosed or inverted isOpen.
closemay be mistakenly interpreted as "near".
Also, why is it a bool ? Just make it a OpenOrClosed.
Set the enum values to make the later if () naturally readable.
simple_svg_1.0.0.hpp
Outdated
| } | ||
|
|
||
| void startNewSubPath() | ||
| void startNewSubPath(OpenOrClosed closure = Closed) |
Owner
There was a problem hiding this comment.
Rename closure to isClosed or inverted isOpen.
Author
|
Thanks for the review. I made the changes you suggested. Using the enum throughout is certainly more explicit. I was unsure if I should add the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I often want to use paths without a fill, but with multiple sub-paths that share the Stroke style (e.g. to plot a maze). So I added an optional parameter to
startNewSubPath, that is either Open or Closed. Since the default is Closed, the old behavior is preserved. I used an enum to make the using code more expressive, i.e.instead of