diff --git a/src/Images/ColorRangeInput.jsx b/src/Images/ColorRangeInput.jsx index 880aea8..f813891 100644 --- a/src/Images/ColorRangeInput.jsx +++ b/src/Images/ColorRangeInput.jsx @@ -72,6 +72,12 @@ function ColorRangeInput(props) { const currentRangeMin = currentRange[0] const currentRangeMax = currentRange[1] + const [rangeMin, rangeMax] = + actorContext.image.scaleInfo[actorContext.renderedScale].ranges[ + actorContext.selectedComponent + ] + const step = + imageType.slice(0, 5) === 'float' ? (rangeMax - rangeMin) / 200 : 1 const [minIntent, setminIntent] = useState(currentRangeMin) const [maxIntent, setmaxIntent] = useState(currentRangeMax) @@ -163,14 +169,11 @@ function ColorRangeInput(props) { invalidNumber: minIntent >= maxIntent })} type="number" - value={ - imageType.slice(0, 5) === 'float' - ? Number.parseFloat(minIntent).toExponential(2) - : minIntent - } + value={minIntent} onChange={(e) => { rangeMinChanged(e.target.value) }} + step={step} /> @@ -180,14 +183,11 @@ function ColorRangeInput(props) { invalidNumber: maxIntent <= minIntent })} type="number" - value={ - imageType.slice(0, 5) === 'float' - ? Number.parseFloat(maxIntent).toExponential(2) - : maxIntent - } + value={maxIntent} onChange={(e) => { rangeMaxChanged(e.target.value) }} + step={step} />