|
@@ -343,9 +343,22 @@ const ViewerContainer: React.FC<ViewerContainerProps> = ({ imageUrls }) => {
|
|
|
if (action.startsWith('AddPredefinedMark:')) {
|
|
if (action.startsWith('AddPredefinedMark:')) {
|
|
|
const markText = action.substring('AddPredefinedMark:'.length);
|
|
const markText = action.substring('AddPredefinedMark:'.length);
|
|
|
console.log(`添加预定义标记到图像: ${markText}`);
|
|
console.log(`添加预定义标记到图像: ${markText}`);
|
|
|
- selectedViewportIds.forEach((viewportId) => {
|
|
|
|
|
- addCustomMark(viewportId, markText);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (selectedViewportIds.length > 0) {
|
|
|
|
|
+ // 有选中的viewport,只对选中的添加
|
|
|
|
|
+ selectedViewportIds.forEach((viewportId) => {
|
|
|
|
|
+ addCustomMark(viewportId, markText);
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 没有选中,为所有可见的viewport添加
|
|
|
|
|
+ const visibleViewportCount = getVisibleViewportCount();
|
|
|
|
|
+ for (let i = 0; i < visibleViewportCount; i++) {
|
|
|
|
|
+ const viewportId = getViewportIdByUrl(imageUrls[i]);
|
|
|
|
|
+ if (viewportId) {
|
|
|
|
|
+ addCustomMark(viewportId, markText);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
dispatch(clearAction());
|
|
dispatch(clearAction());
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -404,17 +417,30 @@ const ViewerContainer: React.FC<ViewerContainerProps> = ({ imageUrls }) => {
|
|
|
addMark(viewportId);
|
|
addMark(viewportId);
|
|
|
});
|
|
});
|
|
|
break;
|
|
break;
|
|
|
- case 'AddCustomMark':
|
|
|
|
|
|
|
+ case 'AddCustomMark': {
|
|
|
// 从markPanel状态获取选中的标记文本(用于自定义标记)
|
|
// 从markPanel状态获取选中的标记文本(用于自定义标记)
|
|
|
const selectedMarkText = store.getState().markPanel.selectedMark;
|
|
const selectedMarkText = store.getState().markPanel.selectedMark;
|
|
|
console.log(`添加自定义标记到图像: ${selectedMarkText}`);
|
|
console.log(`添加自定义标记到图像: ${selectedMarkText}`);
|
|
|
if (selectedMarkText) {
|
|
if (selectedMarkText) {
|
|
|
- selectedViewportIds.forEach((viewportId) => {
|
|
|
|
|
- addCustomMark(viewportId, selectedMarkText);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if (selectedViewportIds.length > 0) {
|
|
|
|
|
+ // 有选中的viewport,只对选中的添加
|
|
|
|
|
+ selectedViewportIds.forEach((viewportId) => {
|
|
|
|
|
+ addCustomMark(viewportId, selectedMarkText);
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 没有选中,为所有可见的viewport添加
|
|
|
|
|
+ const visibleViewportCount = getVisibleViewportCount();
|
|
|
|
|
+ for (let i = 0; i < visibleViewportCount; i++) {
|
|
|
|
|
+ const viewportId = getViewportIdByUrl(imageUrls[i]);
|
|
|
|
|
+ if (viewportId) {
|
|
|
|
|
+ addCustomMark(viewportId, selectedMarkText);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
- case 'AddTimestamp':
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ case 'AddTimestamp': {
|
|
|
const now = new Date();
|
|
const now = new Date();
|
|
|
const timestamp = now.getFullYear() + '-' +
|
|
const timestamp = now.getFullYear() + '-' +
|
|
|
String(now.getMonth() + 1).padStart(2, '0') + '-' +
|
|
String(now.getMonth() + 1).padStart(2, '0') + '-' +
|
|
@@ -423,10 +449,23 @@ const ViewerContainer: React.FC<ViewerContainerProps> = ({ imageUrls }) => {
|
|
|
String(now.getMinutes()).padStart(2, '0') + ':' +
|
|
String(now.getMinutes()).padStart(2, '0') + ':' +
|
|
|
String(now.getSeconds()).padStart(2, '0');
|
|
String(now.getSeconds()).padStart(2, '0');
|
|
|
|
|
|
|
|
- selectedViewportIds.forEach((viewportId) => {
|
|
|
|
|
- addCustomMark(viewportId, timestamp);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if (selectedViewportIds.length > 0) {
|
|
|
|
|
+ // 有选中的viewport,只对选中的添加
|
|
|
|
|
+ selectedViewportIds.forEach((viewportId) => {
|
|
|
|
|
+ addCustomMark(viewportId, timestamp);
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 没有选中,为所有可见的viewport添加
|
|
|
|
|
+ const visibleViewportCount = getVisibleViewportCount();
|
|
|
|
|
+ for (let i = 0; i < visibleViewportCount; i++) {
|
|
|
|
|
+ const viewportId = getViewportIdByUrl(imageUrls[i]);
|
|
|
|
|
+ if (viewportId) {
|
|
|
|
|
+ addCustomMark(viewportId, timestamp);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
break;
|
|
break;
|
|
|
|
|
+ }
|
|
|
case 'Delete Digital Mask':
|
|
case 'Delete Digital Mask':
|
|
|
selectedViewportIds.forEach((viewportId) => {
|
|
selectedViewportIds.forEach((viewportId) => {
|
|
|
remoteMask(viewportId);
|
|
remoteMask(viewportId);
|