Skip to content

Commit

Permalink
front: fixed bug or first number of the position field cannot be cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
theocrsb committed Jun 28, 2024
1 parent 435263b commit ff78cf2
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const TrackSplitLeftPanel: FC<unknown> = () => {
id="offset"
type="number"
inputProps={{ required: true }}
value={state.offset / 1000}
value={state.offset === 0 ? '' : state.offset / 1000}
min={0}
max={trackLength}
whiteBG
Expand All @@ -100,8 +100,10 @@ const TrackSplitLeftPanel: FC<unknown> = () => {
: undefined
}
onChange={(e) => {
if (!Number.isNaN(e.target.valueAsNumber))
setState((prev) => ({ ...prev, offset: e.target.valueAsNumber * 1000 }));
setState((prev) => ({
...prev,
offset: (!Number.isNaN(e.target.valueAsNumber) ? e.target.valueAsNumber : 0) * 1000,
}));
}}
/>
</form>
Expand Down

0 comments on commit ff78cf2

Please sign in to comment.