react-slider icon indicating copy to clipboard operation
react-slider copied to clipboard

Wrong placement for elements with negative number

Open shinspiegel opened this issue 2 years ago • 2 comments

Description

It appears that some calculation for the position breaks if there are values with a negative number. In special if we have marks defined. With multiple buttons, some of them also break.

CodeSandbox

Minimum Example

Edit zillow/react-slider

shinspiegel avatar Sep 27 '22 09:09 shinspiegel

react-slider does not support negative values. We would need to add it as a new feature.

kris-ellery avatar Sep 27 '22 15:09 kris-ellery

Best way is to set the min/max/step of the slider to whole integer numbers, say 0 to 100 with a step of 1, and then use a scale (e.g. d3-scale's linear scale) to go from your negative domain to the range of the slider and back. You can write a small wrapper component to abstract this complexity away.

axelboc avatar Sep 27 '22 16:09 axelboc