This repository has been archived by the owner on Feb 19, 2022. It is now read-only.
Make path helpers work correctly with decimal values #300
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 FormidableLabs/victory#753
Using math.round in all of these functions meant that the round could go one way or the other if provided decimal x or y values, which in turn would mess up the point shapes.
Everywhere I could, just swapped functions over to use
Math.floor
. Unfortunately, forplus
,square
, anddiamond
that lead to dramatically different results. For those, I had to rework the way the shapes were drawn quite a bit. For the most part, the shapes should be very similar. Using floor instead of round meant that some of the shapes decreased in size ever so slightly, and I had to completely rethink how plus was drawn, so the version I have is more symmetrical than the old version, but it seemed worth it to get rid of the old shapes.For comparison's sake, here's all of the shapes, going from size
2
to13
in increments of three. The right icon in each pair is the old implementation ofpath-helpers
and left icon is my implementation.