diff --git a/src/components/Components/GCodePreview/GCodePreview.jsx b/src/components/Components/GCodePreview/GCodePreview.jsx index aa76351a..d521f0aa 100644 --- a/src/components/Components/GCodePreview/GCodePreview.jsx +++ b/src/components/Components/GCodePreview/GCodePreview.jsx @@ -710,6 +710,22 @@ function GCodePreview(props) { const loadingLabel = loader.planning ? 'Calculating motion...' : `Parsing G-code... ${segmentCount.toLocaleString()} moves` + const isLineType = mode.kind === 'category' + const legend = + model && (ready || segmentCount > 0) ? ( + setShowTravel((prev) => !prev)} + range={displayRange} + autoRange={autoRange || displayRange} + onRangeChange={handleRangeChange} + /> + ) : null return ( ) : null} + {legend && !isLineType ? ( + + {legend} + + ) : null} - {model && (ready || segmentCount > 0) ? ( - setShowTravel((prev) => !prev)} - range={displayRange} - autoRange={autoRange || displayRange} - onRangeChange={handleRangeChange} - /> - ) : null} + {legend && isLineType ? legend : null}
- + - - {loadingLabel} - - + + + {loadingLabel} + + +
) : null} diff --git a/src/components/Components/GCodePreview/GCodeViewer/GCodeLegend.jsx b/src/components/Components/GCodePreview/GCodeViewer/GCodeLegend.jsx index d8319d22..28b0e2ec 100644 --- a/src/components/Components/GCodePreview/GCodeViewer/GCodeLegend.jsx +++ b/src/components/Components/GCodePreview/GCodeViewer/GCodeLegend.jsx @@ -1,7 +1,8 @@ import PropTypes from 'prop-types' -import { Button, Flex, InputNumber, Typography } from 'antd' +import { Button, Flex, Typography } from 'antd' import { FEATURE, FEATURE_INFO } from './featureTypes.js' import { TOOL_PALETTE, rampCss } from './colorModes.js' +import InputNumberCal from '../../../Dashboard/common/InputNumberCal.jsx' const { Text } = Typography @@ -151,21 +152,19 @@ function GCodeLegend({ autoRange != null && (range.min !== autoRange.min || range.max !== autoRange.max) const isDuration = mode.stat === 'layerTime' + const unitSuffix = mode.unit || undefined return ( - - {mode.label} - {isDuration ? ( {format(min)} ) : ( - Number.isFinite(value) && onRangeChange({ min: value, max }) } - style={{ width: 80 }} + suffix={unitSuffix} + style={{ width: 100 }} controls={false} /> )} @@ -180,21 +179,16 @@ function GCodeLegend({ {isDuration ? ( {format(max)} ) : ( - Number.isFinite(value) && onRangeChange({ min, max: value }) } - style={{ width: 80 }} + suffix={unitSuffix} + style={{ width: 100 }} controls={false} /> )} - {mode.unit ? ( - - {mode.unit} - - ) : null} {overridden ? (