|
|
|
@ -64,6 +64,14 @@ function GenerateImageEditMenuIcon({ tool, className = "h-5 w-5" }: { tool: Medi |
|
|
|
</svg> |
|
|
|
); |
|
|
|
} |
|
|
|
if (tool === "annotate") { |
|
|
|
return ( |
|
|
|
<svg className={className} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={1.8}> |
|
|
|
<path strokeLinecap="round" strokeLinejoin="round" d="M12 20h9" /> |
|
|
|
<path strokeLinecap="round" strokeLinejoin="round" d="M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5Z" /> |
|
|
|
</svg> |
|
|
|
); |
|
|
|
} |
|
|
|
return ( |
|
|
|
<svg className={className} fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={1.8}> |
|
|
|
<rect x="7" y="7" width="10" height="10" rx="1.5" /> |
|
|
|
@ -297,6 +305,10 @@ export function GenerateImageNodeView({ id, data, selected, renderInputHandle = |
|
|
|
openNodeTool("inpainting"); |
|
|
|
}, [openNodeTool]); |
|
|
|
|
|
|
|
const startAnnotationTool = useCallback(() => { |
|
|
|
openNodeTool("annotate"); |
|
|
|
}, [openNodeTool]); |
|
|
|
|
|
|
|
const handleEditMenuPrimaryClick = useCallback((event: React.MouseEvent<HTMLButtonElement>) => { |
|
|
|
event.preventDefault(); |
|
|
|
event.stopPropagation(); |
|
|
|
@ -312,9 +324,13 @@ export function GenerateImageNodeView({ id, data, selected, renderInputHandle = |
|
|
|
startInpaintingTool(); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (activeEditMenuTool === "annotate") { |
|
|
|
startAnnotationTool(); |
|
|
|
return; |
|
|
|
} |
|
|
|
setActiveEditMenuTool("crop"); |
|
|
|
startCropTool(); |
|
|
|
}, [activeEditMenuTool, handleCreateHighDefinitionNode, startCropTool, startInpaintingTool, startOutpaintingTool]); |
|
|
|
}, [activeEditMenuTool, handleCreateHighDefinitionNode, startAnnotationTool, startCropTool, startInpaintingTool, startOutpaintingTool]); |
|
|
|
|
|
|
|
const handleCarouselPrevious = useCallback(async () => { |
|
|
|
const history = nodeData.imageHistory || []; |
|
|
|
@ -437,7 +453,8 @@ export function GenerateImageNodeView({ id, data, selected, renderInputHandle = |
|
|
|
activeNodeTool === "crop" || |
|
|
|
activeNodeTool === "outpainting" || |
|
|
|
activeNodeTool === "inpainting" || |
|
|
|
activeNodeTool === "splitGrid" |
|
|
|
activeNodeTool === "splitGrid" || |
|
|
|
activeNodeTool === "annotate" |
|
|
|
? activeNodeTool |
|
|
|
: null; |
|
|
|
const isEditingImage = Boolean(activeImageEditTool); |
|
|
|
@ -472,6 +489,11 @@ export function GenerateImageNodeView({ id, data, selected, renderInputHandle = |
|
|
|
icon: <GenerateImageEditMenuIcon tool="crop" className="h-4 w-4" />, |
|
|
|
label: t("imageInput.crop"), |
|
|
|
}, |
|
|
|
{ |
|
|
|
key: "annotate", |
|
|
|
icon: <GenerateImageEditMenuIcon tool="annotate" className="h-4 w-4" />, |
|
|
|
label: "标注", |
|
|
|
}, |
|
|
|
], |
|
|
|
menuOnClick: ({ key, domEvent }) => { |
|
|
|
domEvent.preventDefault(); |
|
|
|
@ -495,6 +517,10 @@ export function GenerateImageNodeView({ id, data, selected, renderInputHandle = |
|
|
|
setActiveEditMenuTool("crop"); |
|
|
|
startCropTool(); |
|
|
|
} |
|
|
|
if (key === "annotate") { |
|
|
|
setActiveEditMenuTool("annotate"); |
|
|
|
startAnnotationTool(); |
|
|
|
} |
|
|
|
}, |
|
|
|
}), |
|
|
|
{ |
|
|
|
|