Merged
Conversation
4d3262e to
f4e970b
Compare
rekmarks
reviewed
Oct 11, 2021
55fc664 to
f1569cd
Compare
rekmarks
previously approved these changes
Oct 11, 2021
Member
rekmarks
left a comment
There was a problem hiding this comment.
I'm not gonna pretend to understand how any of this works, but the code organization looks good, and the gradient example looks just the same as before.
LGTM!
f1569cd to
c0367a4
Compare
Member
Author
|
This has been rebased to resolve conflicts.
I'd be happy to walk through any of this, if it would be helpful! I think it could be explained easily. |
rekmarks
previously approved these changes
Oct 12, 2021
Gudahtt
commented
Oct 12, 2021
The model now supports having SVG gradients applied to individual chunks. A new `gradients` property has been added to the JSON model that contains a map of gradient IDs to definitions. A gradient is applied to a chunk by setting the optional chunk property `gradient` to a gradient ID. Both linear and radial gradients are supported, along with most SVG attributes. Any attribute with a limited set of options is validated to ensure it is set correctly, but the attributes that take lengths or colors simply ensure the value is a string (validating them property would be challenging). Validation has been added to throw an error if any unsupported attributes are present. The "gradient" demo has been updated to use this new gradient support. Now that example sets the gradient on each chunk rather than applying an overlay and masking it to match the model's shape. This greatly simplifies the example. Also the example-specific model files have been moved into the `example` directory. A new model was needed for the updated gradient example, and this seemed like a better place for it to go, so that the top-level of the repository doesn't get too cluttered.
Color and gradient are mutually exclusive options, so they should not both be set. An error is now thrown if both are set, so that there is no ambiguoity about how the polygon will be colored.
This attribute was supported by both types of gradient, but it was missing from the list of common attributes.
c0367a4 to
21f2416
Compare
Member
Author
|
Updated! I added JSDoc comments, and I added validation to ensure |
JSDoc comments have been added for the two functions that have been modified in this PR.
21f2416 to
0e3fb23
Compare
Merged
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.
The model now supports having SVG gradients applied to individual chunks. A new
gradientsproperty has been added to the JSON model that contains a map of gradient IDs to definitions. A gradient is applied to a chunk by setting the optional chunk propertygradientto a gradient ID.Both linear and radial gradients are supported, along with most SVG attributes. Any attribute with a limited set of options is validated to ensure it is set correctly, but the attributes that take lengths or colors simply ensure the value is a string (validating them property would be challenging). Validation has been added to throw an error if any unsupported attributes are present.
The "gradient" demo has been updated to use this new gradient support. Now that example sets the gradient on each chunk rather than applying an overlay and masking it to match the model's shape. This greatly simplifies the example.
Also the example-specific model files have been moved into the
exampledirectory. A new model was needed for the updated gradient example, and this seemed like a better place for it to go, so that the top-level of the repository doesn't get too cluttered.