fseehawer / react-circular-slider

A simple circular slider for react
https://fseehawer.github.io/react-circular-slider/
170 stars 63 forks source link

Knob doesn't start at the top #47

Closed thisismygatekeeper closed 2 years ago

thisismygatekeeper commented 2 years ago

I was trying this set up

<CircularSlider
  label="Test"
  labelColor="white"
  progressSize={0}
  trackSize={16}
  knobSize={48}
  knobColor={"#3AFAEF"}
  knobPosition="top"
  data={[0, 1, 2]}
  dataIndex={0}
/>

But the initial position of the knob is like this

Screen Shot 2022-02-23 at 11 03 45 AM

Is there any way we can make the knob starts at the exact top? Thank you!

fseehawer commented 2 years ago

That's because the three values (0, 1, 2) are evenly spread to 360 degrees and the knob is positioned in the middle of each section. Currently, there is no prop to position the knob at the beginning or at the end of each section.

155389367-7967101f-4bb4-45a3-85d4-409779cf4036
Janvampierssel commented 1 year ago

There is a way to set it at the top!

With dataIndex={} you can adjust the value until it visually initiates at the start.

For my 10-step slider I need to set it to dataIndex={-0.49} for it to be (almost) exactly at the top.