You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's possible to end up with values like 15.555555557px with baseSpacing. My company uses shevyjs in multiple projects and we're repeating lots of logic with correcting floating point errors by rounding to two significant figures.
Could you provide an option in the constructor to round to a configurable number of decimal places? For instance
I can open a PR if you want to include this option.
The text was updated successfully, but these errors were encountered:
daniellizik
changed the title
correct css floating point by rounding baseSpacing result
[feature] correct css floating point by rounding baseSpacing result
Mar 27, 2019
Hey Daniel, cool to hear that your company uses the project. There are a few ways I can see tackling this problem, but the one closest to what you expressed I think would require 2 configuration options. The first, which you have as roundTo, might be better as roundingPrecision, would be a number. The second, so that we don't introduce a breaking change to the API, is useRounding, would be a boolean that defaults to false.
It's possible to end up with values like
15.555555557px
withbaseSpacing
. My company uses shevyjs in multiple projects and we're repeating lots of logic with correcting floating point errors by rounding to two significant figures.Could you provide an option in the constructor to round to a configurable number of decimal places? For instance
I can open a PR if you want to include this option.
The text was updated successfully, but these errors were encountered: