Skip to content

Commit

Permalink
Merge pull request #383 from andyjxli/fix/andy_slider-mark-bug
Browse files Browse the repository at this point in the history
fix: 刻度计算问题,input number 样式问题
  • Loading branch information
honkinglin authored Feb 23, 2022
2 parents 13022c5 + 37a5ec8 commit d24ba00
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
7 changes: 4 additions & 3 deletions src/slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const Slider = forwardRef<HTMLDivElement, SliderProps>(
}
return marks.map((mark) => ({
value: mark,
position: (mark - min) / max,
position: (mark - min) / (max - min),
label: mark,
}));
}
Expand Down Expand Up @@ -118,14 +118,14 @@ const Slider = forwardRef<HTMLDivElement, SliderProps>(

return (
<InputNumber
theme="normal"
value={currentValue}
onChange={(value: number) => handleInputChange(Number(value), nodeIndex)}
className={classNames(`${classPrefix}-slider-input`, {
'is-vertical': isVertical,
})}
disabled={disabled}
{...inputProps}
theme="column"
/>
);
};
Expand Down Expand Up @@ -211,7 +211,7 @@ const Slider = forwardRef<HTMLDivElement, SliderProps>(
></div>
{range ? createHandleButton(LEFT_NODE, { [startDirection]: numberToPercent(start) }) : null}
{createHandleButton(RIGHT_NODE, { [startDirection]: numberToPercent(end) })}
<div className={classNames(`${classPrefix}-slider__step`)}>
<div>
{renderDots.map(({ position, value }) => (
<div
key={value}
Expand Down Expand Up @@ -241,6 +241,7 @@ const Slider = forwardRef<HTMLDivElement, SliderProps>(
})}
>
{range && createInput(LEFT_NODE)}
{range && <div className={`${classPrefix}-slider__center-line`}></div>}
{createInput(RIGHT_NODE)}
</div>
) : null}
Expand Down
Loading

0 comments on commit d24ba00

Please sign in to comment.