fix(segmentation scroll): and hydration bugs (#3701)

This commit is contained in:
Joe Boccanfuso 2023-10-05 22:13:08 -04:00 committed by GitHub
parent 748acaf9c1
commit 1fd98d9220
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 21 deletions

View File

@ -217,7 +217,7 @@ export default function PanelSegmentation({
return ( return (
<> <>
<div className="flex min-h-0 flex-auto select-none flex-col justify-between"> <div className="ohif-scrollbar flex min-h-0 flex-auto select-none flex-col justify-between overflow-auto">
<SegmentationGroupTable <SegmentationGroupTable
title={t('Segmentations')} title={t('Segmentations')}
segmentations={segmentations} segmentations={segmentations}

View File

@ -18,10 +18,14 @@ const Notification = ({ id, type, message, actions, onSubmit, onOutsideClick })
} }
}; };
// Both a mouse down and up listeners are desired so as to avoid missing events
// from elements that have pointer-events:none (e.g. the active viewport).
document.addEventListener('mousedown', handleClick); document.addEventListener('mousedown', handleClick);
document.addEventListener('mouseup', handleClick);
return () => { return () => {
document.removeEventListener('mousedown', handleClick); document.removeEventListener('mousedown', handleClick);
document.removeEventListener('mouseup', handleClick);
}; };
}, [onOutsideClick]); }, [onOutsideClick]);

View File

@ -75,14 +75,16 @@ function SegmentationDropDownRow({
storeSegmentation(activeSegmentation.id); storeSegmentation(activeSegmentation.id);
}, },
}, },
{
title: 'Download',
onClick: () => {
onSegmentationDownload(activeSegmentation.id);
},
},
] ]
: []), : []),
...[
{
title: 'Download',
onClick: () => {
onSegmentationDownload(activeSegmentation.id);
},
},
],
]} ]}
> >
<div className="hover:bg-secondary-dark mx-1 grid h-[28px] w-[28px] cursor-pointer place-items-center rounded-[4px]"> <div className="hover:bg-secondary-dark mx-1 grid h-[28px] w-[28px] cursor-pointer place-items-center rounded-[4px]">

View File

@ -104,20 +104,18 @@ const SegmentationGroupTable = ({
</div> </div>
) : ( ) : (
<div className="mt-1 select-none"> <div className="mt-1 select-none">
{!disableEditing && ( <SegmentationDropDownRow
<SegmentationDropDownRow segmentations={segmentations}
segmentations={segmentations} disableEditing={disableEditing}
disableEditing={disableEditing} activeSegmentation={activeSegmentation}
activeSegmentation={activeSegmentation} onActiveSegmentationChange={onActiveSegmentationChange}
onActiveSegmentationChange={onActiveSegmentationChange} onSegmentationDelete={onSegmentationDelete}
onSegmentationDelete={onSegmentationDelete} onSegmentationEdit={onSegmentationEdit}
onSegmentationEdit={onSegmentationEdit} onSegmentationDownload={onSegmentationDownload}
onSegmentationDownload={onSegmentationDownload} storeSegmentation={storeSegmentation}
storeSegmentation={storeSegmentation} onSegmentationAdd={onSegmentationAdd}
onSegmentationAdd={onSegmentationAdd} onToggleSegmentationVisibility={onToggleSegmentationVisibility}
onToggleSegmentationVisibility={onToggleSegmentationVisibility} />
/>
)}
{!disableEditing && showAddSegment && ( {!disableEditing && showAddSegment && (
<AddSegmentRow onClick={() => onSegmentAdd(activeSegmentationId)} /> <AddSegmentRow onClick={() => onSegmentAdd(activeSegmentationId)} />
)} )}