Skip to content

Commit

Permalink
fix cr
Browse files Browse the repository at this point in the history
  • Loading branch information
jljsj33 committed Dec 8, 2020
1 parent 6627027 commit d38a808
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ class Slider extends React.Component<SliderProps, SliderState> {
return 0;
}

positionGetValue = (position): number[] => {
return [];
};

calcOffset(value: number) {
return 0;
}
Expand Down Expand Up @@ -246,7 +250,7 @@ class Slider extends React.Component<SliderProps, SliderState> {
ariaLabelledBy: ariaLabelledByForHandle,
ariaValueTextFormatter: ariaValueTextFormatterForHandle,
style: handleStyle[0] || handleStyle,
ref: h => this.saveHandle(0, h),
ref: (h) => this.saveHandle(0, h),
});

const trackOffset = startPoint !== undefined ? this.calcOffset(startPoint) : 0;
Expand Down
5 changes: 2 additions & 3 deletions src/common/createSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default function createSlider<
const { draggableTrack, vertical: isVertical } = this.props;
const { bounds } = this.state;

const value = this.positionGetValue(p) || [];
const value = draggableTrack && this.positionGetValue ? this.positionGetValue(p) || [] : [];

const inPoint = utils.isEventFromHandle(e, this.handlesRefs);
this.inTrack =
Expand All @@ -119,15 +119,14 @@ export default function createSlider<
})
.some((c) => !c);

const handlePosition = utils.getHandleCenterPosition(isVertical, e.target);

if (this.inTrack) {
this.dragOffset = p;
this.startBounds = [...bounds];
} else {
if (!inPoint) {
this.dragOffset = 0;
} else {
const handlePosition = utils.getHandleCenterPosition(isVertical, e.target);
this.dragOffset = p - handlePosition;
p = handlePosition;
}
Expand Down

0 comments on commit d38a808

Please sign in to comment.