Closed Nidoxs closed 2 months ago
Ah I can see you do have this already:
function GetPercent(control: AdvancedTypes.Slider, current: number) {
const gap = control.Max - control.Min;
return (current - control.Min) / gap;
}
This is then called in a useEffect
upon first render and when there are any subsequent changes to props.Current
No, I just checked this and it was in fact wrong.
It's called in a useUpdateEffect
which wont run at start, I dont remember what I was doing there honestly
Thanks for pointing this out!
It seems that the
Slider
control has a visual bug where regardless of the initial value, the dragger is always at 50%. I took a look at the source code and the initial spring value forpercent
is0.5
.As far as I can see from the component props and general source code of
Slider
, the initial value should be(props.Current - props.Min) / (Props.Max - Props.Min)
. I could be wrong here though, not looked at it too deeply so there may be a reason why you've got that 0.5 default value.Let me know what you think 👍