import React from 'react'; import { useTranslation } from 'react-i18next'; import { Tabs, TabsList, TabsTrigger } from '../Tabs'; import { Slider } from '../Slider'; import { Icons } from '../Icons'; import { Switch } from '../Switch'; import { Label } from '../Label'; import { Input } from '../Input'; import { useSegmentationTableContext } from './contexts'; export const SegmentationTableConfig: React.FC<{ children?: React.ReactNode }> = ({ children }) => { const { t } = useTranslation('SegmentationPanel'); const { renderFill, renderOutline, setRenderFill, setRenderFillInactive, setRenderOutline, setRenderOutlineInactive, fillAlpha, fillAlphaInactive, outlineWidth, setFillAlpha, setFillAlphaInactive, setOutlineWidth, renderInactiveSegmentations, toggleRenderInactiveSegmentations, segmentationRepresentationTypes, data, } = useSegmentationTableContext('SegmentationTableConfig'); if (!data?.length) { return null; } return (
{t('Show')}:{' '} {renderFill && renderOutline ? t('Fill & Outline') : renderOutline ? t('Outline Only') : t('Fill Only')} { const type = segmentationRepresentationTypes?.[0]; if (value === 'fill-and-outline') { setRenderFill({ type }, true); setRenderOutline({ type }, true); setRenderFillInactive({ type }, true); setRenderOutlineInactive({ type }, true); } else if (value === 'outline') { setRenderFill({ type }, false); setRenderOutline({ type }, true); setRenderFillInactive({ type }, false); setRenderOutlineInactive({ type }, true); } else { setRenderFill({ type }, true); setRenderOutline({ type }, false); setRenderFillInactive({ type }, true); setRenderOutlineInactive({ type }, false); } }} >
setFillAlpha({ type: segmentationRepresentationTypes?.[0] }, value) } max={1} min={0} step={0.1} /> setFillAlpha({ type: segmentationRepresentationTypes?.[0] }, Number(e.target.value)) } />
setOutlineWidth({ type: segmentationRepresentationTypes?.[0] }, value) } max={10} min={0} step={0.1} className="mx-1 flex-1" /> setOutlineWidth( { type: segmentationRepresentationTypes?.[0] }, Number(e.target.value) ) } className="mx-1 w-10 flex-none text-center" />
{renderInactiveSegmentations && (
setFillAlphaInactive({}, value)} max={1} min={0} step={0.1} /> setFillAlphaInactive({}, Number(e.target.value))} />
)} {children}
); };