TanStack / ranger

🤖 Headless utilities for building range and multi-range sliders in React, Preact, Solid, Vue, Svelte and Angular
MIT License
753 stars 63 forks source link

Configurable interpolation #5

Closed etimberg closed 6 years ago

etimberg commented 6 years ago

Allows configuration between 'linear' and 'logarithmic' interpolation. Log interpolation only works for positive values at the moment.

@tannerlinsley lemme know your thoughts on how to split out the logic. I was thinking about using a file for each type of scale to contain the logic.

tannerlinsley commented 6 years ago

I love it. I was also thinking that the scales could be exported so instead of a string, you pass the interpolation function:

import ReactRanger, { logInterpolator } from 'react-ranger'

<ReactRanger
    interpolator={logInterpolator}
/>

Thoughts?

etimberg commented 6 years ago

Yeah, I like that! Will play around and see how it goes

etimberg commented 6 years ago

@tannerlinsley I made a few changes. Created two interpolators and moved them off into their own files.

I tested using the codesandbox setup you have. Once we get a CI in, I can get tests running

tannerlinsley commented 6 years ago

💯

Simek commented 6 years ago

@tannerlinsley When you are planning to release version with this feature to NPM?

apa-sl commented 6 years ago

I also really miss proper non-linear ranges support...