fix(state synchronization): SEG and RT viewports should keep their before hydration voi (#3560)
This commit is contained in:
1 parent
4f037ae55e
commit
8adf663248
12 files changed
+140
-43
No files matched your search
@@ -10,8 +10,14 @@ const DEFAULT = 'default';
|
||||
// dragged and dropped the view in twice. For example, it allows displaying
|
||||
// bone, brain and soft tissue views of a single display set, and to still
|
||||
// remember the specific changes to each viewport.
|
||||
const addUniqueIndex = (arr, key, viewports) => {
|
||||
const addUniqueIndex = (arr, key, viewports, isUpdatingSameViewport) => {
|
||||
arr.push(0);
|
||||
|
||||
// If we are updating the viewport, we should not increment the index
|
||||
if (isUpdatingSameViewport) {
|
||||
return;
|
||||
}
|
||||
|
||||
// The 128 is just a value that is larger than how many viewports we
|
||||
// display at once, used as an upper bound on how many unique presentation
|
||||
// ID's might exist for a single display set at once.
|
||||
@@ -109,8 +115,30 @@ const getPresentationIds = (viewport, viewports): PresentationIds => {
|
||||
lutPresentationArr.push(uid);
|
||||
}
|
||||
|
||||
addUniqueIndex(positionPresentationArr, 'positionPresentationId', viewports);
|
||||
addUniqueIndex(lutPresentationArr, 'lutPresentationId', viewports);
|
||||
// only add unique index if the viewport is getting inserted and not updated
|
||||
const isUpdatingSameViewport = viewports.some(v => {
|
||||
return (
|
||||
v.displaySetInstanceUIDs.toString() ===
|
||||
viewport.displaySetInstanceUIDs.toString() &&
|
||||
v.viewportIndex === viewport.viewportIndex
|
||||
);
|
||||
});
|
||||
|
||||
// if it is updating the viewport we should not increment the index since
|
||||
// it might be a layer on the fusion or a SEG layer that is added on
|
||||
// top of the original display set
|
||||
addUniqueIndex(
|
||||
positionPresentationArr,
|
||||
'positionPresentationId',
|
||||
viewports,
|
||||
isUpdatingSameViewport
|
||||
);
|
||||
addUniqueIndex(
|
||||
lutPresentationArr,
|
||||
'lutPresentationId',
|
||||
viewports,
|
||||
isUpdatingSameViewport
|
||||
);
|
||||
|
||||
const lutPresentationId = lutPresentationArr.join(JOIN_STR);
|
||||
const positionPresentationId = positionPresentationArr.join(JOIN_STR);
|
||||
|
||||
Reference in new issue
Block a user