From ccf8307a39e04bbe09ba37b17c57cae0b4563a1a Mon Sep 17 00:00:00 2001 From: Linghong Date: Tue, 4 Aug 2026 12:48:39 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=8C=E7=BE=8E=E5=83=8F?= =?UTF-8?q?=E7=B4=A0=E6=9C=AA=E6=94=B6=E5=8F=A3=E5=8D=A0=E4=BD=8D=E4=BA=A4?= =?UTF-8?q?=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 发现已有未收口操作时激活原占位并阻止创建新身份。 拒绝右键删除受保护占位时保留当前图层选择。 补齐生成工作流接线和定向回归测试。 --- .../image-editor/ImageCanvasEditorView.tsx | 7 ++++ .../useImageCanvasGenerationSurface.test.tsx | 1 + .../useImageCanvasGenerationSurface.tsx | 5 +++ .../useImageCanvasGenerationWorkflow.test.tsx | 36 +++++++++++++++---- .../useImageCanvasGenerationWorkflow.ts | 6 ++++ 5 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/components/image-editor/ImageCanvasEditorView.tsx b/src/components/image-editor/ImageCanvasEditorView.tsx index 6347cc6d9..e2384d165 100644 --- a/src/components/image-editor/ImageCanvasEditorView.tsx +++ b/src/components/image-editor/ImageCanvasEditorView.tsx @@ -1490,6 +1490,7 @@ export function ImageCanvasEditorView({ activeCanvasGenerationDialog, canvasGenerationDialogs, openCanvasGenerationDialog, + activateCanvasGenerationDialog, updateCanvasGenerationDialogById, hasCanvasGenerationDialogById, archiveActiveCanvasGenerationDialog, @@ -1824,7 +1825,11 @@ export function ImageCanvasEditorView({ const requestRemoveCanvasGenerationDialog = useCallback( (dialog: CanvasGenerationDialogState) => { if (isUnsettledPerfectPixelOperationDialog(dialog)) { + const previousSelectedLayerId = selectedLayerIdRef.current; + const previousSelectedLayerIds = [...selectedLayerIdsRef.current]; activateCanvasGenerationDialog(dialog); + setSelectedLayerId(previousSelectedLayerId); + setSelectedLayerIds(previousSelectedLayerIds); showGenerationWarning( '完美像素结果尚未确认,当前占位用于保留原操作身份;请继续核对或按原操作重试。', ); @@ -1840,6 +1845,8 @@ export function ImageCanvasEditorView({ [ activateCanvasGenerationDialog, removeCanvasGenerationDialog, + setSelectedLayerId, + setSelectedLayerIds, showGenerationWarning, ], ); diff --git a/src/components/image-editor/useImageCanvasGenerationSurface.test.tsx b/src/components/image-editor/useImageCanvasGenerationSurface.test.tsx index fab101b69..7d60180ee 100644 --- a/src/components/image-editor/useImageCanvasGenerationSurface.test.tsx +++ b/src/components/image-editor/useImageCanvasGenerationSurface.test.tsx @@ -152,6 +152,7 @@ function GenerationSurfaceHarness() { activeCanvasGenerationDialog: activeCanvasDialog, canvasGenerationDialogs: dialogs.canvasGenerationDialogs, openCanvasGenerationDialog: dialogs.openCanvasGenerationDialog, + activateCanvasGenerationDialog: dialogs.activateCanvasGenerationDialog, updateCanvasGenerationDialogById: dialogs.updateCanvasGenerationDialogById, hasCanvasGenerationDialogById: dialogs.hasCanvasGenerationDialogById, archiveActiveCanvasGenerationDialog: diff --git a/src/components/image-editor/useImageCanvasGenerationSurface.tsx b/src/components/image-editor/useImageCanvasGenerationSurface.tsx index 1664067fd..364cb97ed 100644 --- a/src/components/image-editor/useImageCanvasGenerationSurface.tsx +++ b/src/components/image-editor/useImageCanvasGenerationSurface.tsx @@ -74,6 +74,9 @@ type ImageCanvasGenerationSurfaceOptions = { openCanvasGenerationDialog: ( dialog: Omit, ) => string; + activateCanvasGenerationDialog: ( + targetDialog: CanvasGenerationDialogState, + ) => void; updateCanvasGenerationDialogById: ( dialogId: string, updater: CanvasGenerationDialogUpdater, @@ -169,6 +172,7 @@ export function useImageCanvasGenerationSurface({ activeCanvasGenerationDialog, canvasGenerationDialogs, openCanvasGenerationDialog, + activateCanvasGenerationDialog, updateCanvasGenerationDialogById, hasCanvasGenerationDialogById, archiveActiveCanvasGenerationDialog, @@ -209,6 +213,7 @@ export function useImageCanvasGenerationSurface({ generateDialog, setGenerateDialog, openCanvasGenerationDialog, + activateCanvasGenerationDialog, updateCanvasGenerationDialogById, hasCanvasGenerationDialogById, archiveActiveCanvasGenerationDialog, diff --git a/src/components/image-editor/useImageCanvasGenerationWorkflow.test.tsx b/src/components/image-editor/useImageCanvasGenerationWorkflow.test.tsx index 61f355698..f3e2a2379 100644 --- a/src/components/image-editor/useImageCanvasGenerationWorkflow.test.tsx +++ b/src/components/image-editor/useImageCanvasGenerationWorkflow.test.tsx @@ -397,6 +397,7 @@ function GenerationWorkflowHarness({ generateDialog: dialogs.generateDialog, setGenerateDialog: dialogs.setGenerateDialog, openCanvasGenerationDialog: dialogs.openCanvasGenerationDialog, + activateCanvasGenerationDialog: dialogs.activateCanvasGenerationDialog, updateCanvasGenerationDialogById: dialogs.updateCanvasGenerationDialogById, hasCanvasGenerationDialogById: dialogs.hasCanvasGenerationDialogById, removeCanvasGenerationDialogsByLayerId: @@ -819,6 +820,18 @@ function GenerationWorkflowHarness({ > 第二图层完美像素 +