Skip to content
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

Merged
merged 1 commit into from
Sep 25, 2017

Conversation

cbranch101
Copy link
Contributor

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, for plus, square, and diamond 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 to 13 in increments of three. The right icon in each pair is the old implementation of path-helpers and left icon is my implementation.

screen shot 2017-09-22 at 12 00 23 pm

…e math.floor and fixes the path helper functions that were dependent on the old rounding behavior
@boygirl
Copy link
Contributor

boygirl commented Sep 25, 2017

@cbranch101 Thank you for this fix!

@boygirl boygirl merged commit e5afed1 into FormidableLabs:master Sep 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants