Viewport grid load default as 1x1 and load first image of series by default (#1817)
This commit is contained in:
1 parent
8f05cf73c7
commit
1d8f5cfc42
5 files changed
+59
-24
No files matched your search
@@ -127,7 +127,6 @@ function PanelStudyBrowser({
|
||||
changedDisplaySets,
|
||||
thumbnailImageSrcMap
|
||||
);
|
||||
|
||||
setDisplaySets(mappedDisplaySets);
|
||||
}
|
||||
);
|
||||
@@ -152,11 +151,11 @@ function PanelStudyBrowser({
|
||||
);
|
||||
const updatedExpandedStudyInstanceUIDs = shouldCollapseStudy
|
||||
? // eslint-disable-next-line prettier/prettier
|
||||
[
|
||||
...expandedStudyInstanceUIDs.filter(
|
||||
stdyUid => stdyUid !== StudyInstanceUID
|
||||
),
|
||||
]
|
||||
[
|
||||
...expandedStudyInstanceUIDs.filter(
|
||||
stdyUid => stdyUid !== StudyInstanceUID
|
||||
),
|
||||
]
|
||||
: [...expandedStudyInstanceUIDs, StudyInstanceUID];
|
||||
|
||||
setExpandedStudyInstanceUIDs(updatedExpandedStudyInstanceUIDs);
|
||||
|
||||
@@ -5,22 +5,40 @@ import {
|
||||
useViewportGrid,
|
||||
} from '@ohif/ui';
|
||||
|
||||
const DEFAULT_LAYOUT = {
|
||||
type: 'SET_LAYOUT',
|
||||
payload: {
|
||||
numCols: 1,
|
||||
numRows: 1,
|
||||
},
|
||||
};
|
||||
|
||||
function LayoutSelector() {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [viewportGridState, dispatch] = useViewportGrid();
|
||||
|
||||
useEffect(() => {
|
||||
function closeOnOutsideClick() {
|
||||
if (isOpen) {
|
||||
setIsOpen(false);
|
||||
}
|
||||
const closeOnOutsideClick = () => {
|
||||
if (isOpen) {
|
||||
setIsOpen(false);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener('click', closeOnOutsideClick);
|
||||
return () => {
|
||||
window.removeEventListener('click', closeOnOutsideClick);
|
||||
};
|
||||
}, [isOpen]);
|
||||
|
||||
useEffect(() => {
|
||||
/* Reset to default layout when component unmounts */
|
||||
return () => {
|
||||
dispatch(DEFAULT_LAYOUT);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const onClickHandler = () => setIsOpen(!isOpen);
|
||||
|
||||
const DropdownContent = isOpen ? OHIFLayoutSelector : null;
|
||||
|
||||
return (
|
||||
@@ -28,9 +46,7 @@ function LayoutSelector() {
|
||||
id="Layout"
|
||||
label="Grid Layout"
|
||||
icon="tool-layout"
|
||||
onClick={() => {
|
||||
setIsOpen(!isOpen);
|
||||
}}
|
||||
onClick={onClickHandler}
|
||||
dropdownContent={
|
||||
DropdownContent !== null && (
|
||||
<DropdownContent
|
||||
|
||||
Reference in new issue
Block a user