fix(bugs): fix patient header for doc, track ball rotate resize observer and add segmentation button not being enabled on viewport data change (#4068)

This commit is contained in:
Ibrahim authored and GitHub committed 2024-04-27 21:50:28 -04:00
1 parent b4ed80d99b
commit c09311d3b7
10 files changed
+107 -57

No files matched your search

@@ -18,8 +18,13 @@ export default function PanelSegmentation({
extensionManager,
configuration,
}) {
const { segmentationService, viewportGridService, uiDialogService, displaySetService } =
servicesManager.services;
const {
segmentationService,
viewportGridService,
uiDialogService,
displaySetService,
cornerstoneViewportService,
} = servicesManager.services;
const { t } = useTranslation('PanelSegmentation');
@@ -82,21 +87,33 @@ export default function PanelSegmentation({
// Handle initial state
handleActiveViewportChange();
const changed = viewportGridService.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED;
const changedGrid = viewportGridService.EVENTS.ACTIVE_VIEWPORT_ID_CHANGED;
const ready = viewportGridService.EVENTS.VIEWPORTS_READY;
const subs = [];
[ready, changed].forEach(evt => {
const subsGrid = [];
[ready, changedGrid].forEach(evt => {
const { unsubscribe } = viewportGridService.subscribe(evt, ({ viewportId }) => {
handleActiveViewportChange(viewportId);
});
subs.push(unsubscribe);
subsGrid.push(unsubscribe);
});
const changedData = cornerstoneViewportService.EVENTS.VIEWPORT_DATA_CHANGED;
const subsData = [];
[changedData].forEach(evt => {
const { unsubscribe } = cornerstoneViewportService.subscribe(evt, () => {
handleActiveViewportChange();
});
subsData.push(unsubscribe);
});
// Clean up
return () => {
subs.forEach(unsub => unsub());
subsGrid.forEach(unsub => unsub());
subsData.forEach(unsub => unsub());
};
}, []);