fix(segmentation): restore navigation for duplicated contour segments (#6038)
--------- Co-authored-by: diattamo <mmddiatta@gmail.com>
This commit is contained in:
1 parent
9a2d2c3d13
commit
0c1ca6b04a
3 files changed
+140
-27
No files matched your search
@@ -2403,14 +2403,25 @@ function commandsModule({
|
||||
targetSegmentInfo?: SegmentInfo;
|
||||
}) => {
|
||||
if (!targetSegmentInfo) {
|
||||
const sourceSegmentation = segmentationService.getSegmentation(
|
||||
sourceSegmentInfo.segmentationId
|
||||
);
|
||||
const sourceCachedStats =
|
||||
sourceSegmentation?.segments?.[sourceSegmentInfo.segmentIndex]?.cachedStats;
|
||||
|
||||
targetSegmentInfo = {
|
||||
segmentationId: sourceSegmentInfo.segmentationId,
|
||||
segmentIndex: segmentationService.getNextAvailableSegmentIndex(
|
||||
sourceSegmentInfo.segmentationId
|
||||
),
|
||||
};
|
||||
|
||||
// Copy source cachedStats so jump-to-segment navigation works on the duplicate segment.
|
||||
segmentationService.addSegment(targetSegmentInfo.segmentationId, {
|
||||
segmentIndex: targetSegmentInfo.segmentIndex,
|
||||
...(sourceCachedStats && {
|
||||
cachedStats: csUtils.deepClone(sourceCachedStats) as Record<string, unknown>,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -896,6 +896,7 @@ class SegmentationService extends PubSubService {
|
||||
active?: boolean;
|
||||
color?: csTypes.Color; // Add color type
|
||||
visibility?: boolean; // Add visibility option
|
||||
cachedStats?: Record<string, unknown>;
|
||||
} = {}
|
||||
): void {
|
||||
if (config?.segmentIndex === 0) {
|
||||
|
||||
Reference in new issue
Block a user