import React from 'react'; import { useTranslation } from 'react-i18next'; import { PanelSection } from '../PanelSection'; 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 './SegmentationTableContext'; export const SegmentationTableConfig: React.FC<{ children?: React.ReactNode }> = ({ children }) => { const { t } = useTranslation('SegmentationTable.AppearanceSettings'); const { renderFill, renderOutline, setRenderFill, setRenderOutline, activeRepresentation, fillAlpha, fillAlphaInactive, outlineWidth, setFillAlpha, setFillAlphaInactive, setOutlineWidth, renderInactiveSegmentations, toggleRenderInactiveSegmentations, data, } = useSegmentationTableContext('styles'); if (!data?.length) { return null; } return (
{t('Appearance Settings')}
{t('Show')}:{' '} {renderFill && renderOutline ? t('Fill & Outline') : renderOutline ? t('Outline Only') : t('Fill Only')} { if (value === 'fill-and-outline') { setRenderFill({ type: activeRepresentation.type }, true); setRenderOutline({ type: activeRepresentation.type }, true); } else if (value === 'outline') { setRenderFill({ type: activeRepresentation.type }, false); setRenderOutline({ type: activeRepresentation.type }, true); } else { setRenderFill({ type: activeRepresentation.type }, true); setRenderOutline({ type: activeRepresentation.type }, false); } }} >
setFillAlpha({ type: activeRepresentation.type }, value) } max={1} min={0} step={0.1} /> setFillAlpha({ type: activeRepresentation.type }, Number(e.target.value)) } />
setOutlineWidth({ type: activeRepresentation.type }, value) } max={10} min={0} step={0.1} className="mx-1 flex-1" /> setOutlineWidth({ type: activeRepresentation.type }, Number(e.target.value)) } className="mx-1 w-10 flex-none text-center" />
{renderInactiveSegmentations && (
setFillAlphaInactive({ type: activeRepresentation.type }, value) } max={1} min={0} step={0.1} /> setFillAlphaInactive({ type: activeRepresentation.type }, Number(e.target.value)) } />
)}
{children}
); };