Skip to content

Commit

Permalink
Render Segment Labels as Value + 1 (to start from 1 instead 0)
Browse files Browse the repository at this point in the history
  • Loading branch information
YeonV committed Apr 17, 2023
1 parent 86fb90c commit 19dc1d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/pages/Devices/EditVirtuals/PixelSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,18 @@ const PixelSlider = ({ s, handleRangeSegment }: any) => {
};

const marks = [
{ value: 0, label: 0 },
{ value: 0, label: 1 },
{
value: devices[s[0]].config.pixel_count - 1,
label: devices[s[0]].config.pixel_count - 1,
label: devices[s[0]].config.pixel_count,
},
];

return (
<Slider
value={range}
marks={marks}
valueLabelFormat={(e) => e + 1}
min={0}
max={devices[s[0]].config.pixel_count - 1}
onChange={(_event: any, n: any) => setRange(n)}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Devices/EditVirtuals/Segment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const Segment = ({ s, i, virtual, segments }: any) => {
<div style={{ minWidth: '120px' }}>
<Typography color="textSecondary">{title}</Typography>
<Typography color="textSecondary">
{s[1] === s[2] ? s[1] : `[ ${s[1]} - ${s[2]} ]`}
{s[1] === s[2] ? s[1] + 1 : `[ ${s[1] + 1} - ${s[2] + 1} ]`}
</Typography>
</div>
</div>
Expand Down

0 comments on commit 19dc1d2

Please sign in to comment.