瀏覽代碼

fix (1.71.0 -> 1.71.1): 修复删除标记功能,只删除选中的文本标记而不删除全部标记

- 修改deleteSelectedMark函数,只删除isSelected为true的TextAnnotationTool标记
- 修复标记添加函数的参数格式化问题
- 优化代码格式和空格使用

改动文件:
- src/pages/view/components/viewers/stack.image.viewer.tsx
dengdx 2 天之前
父節點
當前提交
9276c69f65
共有 3 個文件被更改,包括 27 次插入13 次删除
  1. 12 0
      CHANGELOG.md
  2. 1 1
      package.json
  3. 14 12
      src/pages/view/components/viewers/stack.image.viewer.tsx

+ 12 - 0
CHANGELOG.md

@@ -2,6 +2,18 @@
 
 本项目的所有重要变更都将记录在此文件中.
 
+## [1.71.1] - 2026-01-15 20:45
+
+fix (1.71.0 -> 1.71.1): 修复删除标记功能,只删除选中的文本标记而不删除全部标记
+
+- 修改deleteSelectedMark函数,只删除isSelected为true的TextAnnotationTool标记
+- 修复标记添加函数的参数格式化问题
+- 优化代码格式和空格使用
+
+改动文件:
+
+- src/pages/view/components/viewers/stack.image.viewer.tsx
+
 ## [1.71.0] - 2026-01-15 20:31
 
 feat (1.70.0 -> 1.71.0): 自定义标记和预定义标记使用新的文本模型,支持拖拽和缩放、旋转

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "zsis",
-  "version": "1.71.0",
+  "version": "1.71.1",
   "private": true,
   "description": "医学成像系统",
   "main": "main.js",

+ 14 - 12
src/pages/view/components/viewers/stack.image.viewer.tsx

@@ -33,11 +33,11 @@ import { EVENTS } from '@cornerstonejs/core';
 import { useSelector, useDispatch } from 'react-redux';
 import { selectOverlayEnabled } from '@/states/view/dicomOverlaySlice';
 import { initPlayback, setFrameDetectionResult } from '@/states/view/playbackSlice';
-import { 
-  startLoading, 
-  updateLoadingProgress, 
+import {
+  startLoading,
+  updateLoadingProgress,
   completeLoading,
-  selectViewportLoadingInfo 
+  selectViewportLoadingInfo
 } from '@/states/view/imageLoadingSlice';
 import PolygonLengthMeasurementTool from '@/components/measures/PolygonLengthMeasurementTool';
 import PolylineLengthMeasurementTool from '@/components/measures/PolylineLengthMeasurementTool';
@@ -373,12 +373,12 @@ function setupDefaultToolStates(toolGroup: cornerstoneTools.Types.IToolGroup) {
 }
 export function addLMark(currentViewportId: string): void {
   // 使用专门的文本标记工具管理器
-  TextAnnotationToolManager.activateTextAnnotationTool(currentViewportId, 'L',[100,100]);
+  TextAnnotationToolManager.activateTextAnnotationTool(currentViewportId, 'L', [100, 100]);
 }
 export function addRLabel(currentViewportId: string): void {
   console.log('Adding R Mark viewport id : ', currentViewportId);
   //todo 初始坐标可能需要结合业务和界面大小动态调整
-  TextAnnotationToolManager.activateTextAnnotationTool(currentViewportId, 'R',[900,100]);
+  TextAnnotationToolManager.activateTextAnnotationTool(currentViewportId, 'R', [900, 100]);
 }
 
 
@@ -438,10 +438,12 @@ export function deleteSelectedMark(currentViewportId: string): void {
 
   // 删除所有 LabelTool 创建的标记(包括 L/R 标记、预定义标记、自定义标记、时间戳标记)
   for (const annotation of allAnnotations) {
-    if (annotation.metadata?.toolName === LabelTool.toolName) {
-      cornerstoneTools.annotation.state.removeAnnotation(
-        annotation.annotationUID!
-      );
+    if (annotation.metadata?.toolName === TextAnnotationTool.toolName) {
+      if (annotation.isSelected) {
+        cornerstoneTools.annotation.state.removeAnnotation(
+          annotation.annotationUID!
+        );
+      }
     }
   }
 
@@ -492,7 +494,7 @@ export function addCustomMark(currentViewportId: string, text: string): void {
   const { width, height } = element.getBoundingClientRect();
   const canvasPoint: Types.Point2 = [width / 2, height / 2];
 
-  TextAnnotationToolManager.activateTextAnnotationTool(currentViewportId, text,canvasPoint);
+  TextAnnotationToolManager.activateTextAnnotationTool(currentViewportId, text, canvasPoint);
 
   console.log(`Custom mark "${text}" added successfully`);
 }
@@ -1919,7 +1921,7 @@ const StackViewer = ({
           loadedCount++;
           const newProgress = Math.round((loadedCount / finalImageUrls.length) * 100);
           console.log(`[StackViewer] 图像加载进度: ${loadedCount}/${finalImageUrls.length} (${newProgress}%)`);
-          
+
           dispatch(updateLoadingProgress({
             viewportId,
             loadedCount,