Adding dashed lines#3014
Closed
lorenzo-lipparini wants to merge 2 commits intoprocessing:masterfrom
lorenzo-lipparini:line-dash
Closed
Adding dashed lines#3014lorenzo-lipparini wants to merge 2 commits intoprocessing:masterfrom lorenzo-lipparini:line-dash
lorenzo-lipparini wants to merge 2 commits intoprocessing:masterfrom
lorenzo-lipparini:line-dash
Conversation
Member
|
Usually we suggest opening an issue with the feature request first to discuss the implementation of the feature and whether it is something we want to include in the library, just so that if the implementation needs to be changed or the feature is rejected, you won't have spent too much of your time working on it. I have some comments about this implementation but can you close this PR for the moment and open an issue for the discussion? Thanks! |
Author
|
Ok, the issue (#3016) is now open. |
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.
This pull request adds a
lineDash()function to the p5 prototype which provides an easy way to draw dashed lines.The implementation is based on the native
CanvasRenderingContext2D.getLineDash()/CanvasRenderingContext2D.setLineDash()methods.The changes include:
lineDash()method definition inp5.Renderer2DclasslineDash()method definition inp5classAs this is my first pull request to the p5 project, I had a few problems with the parameter validation system which I didn't manage to get to work, so I'm looking for some help on that. Furthermore, I have no idea how to write tests for the new functionality, so I'll need help on that as well.
There are a few things about the API which I'm not sure about that I'd leave to someone more experienced than me to decide:
lineDash()function accepts an array as its only argument for now, while we might consider to use rest parameters insteadlineDash()function always returns the current line dash settings, and is therefore not chainablelineDash()function can be called with no parameters (it just returns the current settings)noLineDash()function equivalent to callinglineDash([])might be a good addition, since it would probably make the API more clearstrokeCap()andstrokeJoin())Looking forward to receiving your suggestions.