diff --git a/invokeai/frontend/web/public/locales/en.json b/invokeai/frontend/web/public/locales/en.json index 3b04bcff719..5457ae6012f 100644 --- a/invokeai/frontend/web/public/locales/en.json +++ b/invokeai/frontend/web/public/locales/en.json @@ -1718,6 +1718,8 @@ "controlLayer": "Control Layer", "inpaintMask": "Inpaint Mask", "regionalGuidance": "Regional Guidance", + "referenceImageRegional": "Reference Image (Regional)", + "referenceImageGlobal": "Reference Image (Global)", "asRasterLayer": "As $t(controlLayers.rasterLayer)", "asRasterLayerResize": "As $t(controlLayers.rasterLayer) (Resize)", "asControlLayer": "As $t(controlLayers.controlLayer)", diff --git a/invokeai/frontend/web/src/features/gallery/components/ImageContextMenu/ImageMenuItemNewLayerFromImageSubMenu.tsx b/invokeai/frontend/web/src/features/gallery/components/ImageContextMenu/ImageMenuItemNewLayerFromImageSubMenu.tsx index 2e1507586f3..456689cd1b7 100644 --- a/invokeai/frontend/web/src/features/gallery/components/ImageContextMenu/ImageMenuItemNewLayerFromImageSubMenu.tsx +++ b/invokeai/frontend/web/src/features/gallery/components/ImageContextMenu/ImageMenuItemNewLayerFromImageSubMenu.tsx @@ -77,6 +77,32 @@ export const ImageMenuItemNewLayerFromImageSubMenu = memo(() => { }); }, [imageDTO, imageViewer, store, t]); + const onClickNewRegionalReferenceImageFromImage = useCallback(() => { + const { dispatch, getState } = store; + createNewCanvasEntityFromImage({ imageDTO, type: 'reference_image', dispatch, getState }); + dispatch(sentImageToCanvas()); + dispatch(setActiveTab('canvas')); + imageViewer.close(); + toast({ + id: 'SENT_TO_CANVAS', + title: t('toast.sentToCanvas'), + status: 'success', + }); + }, [imageDTO, imageViewer, store, t]); + + const onClickNewGlobalReferenceImageFromImage = useCallback(() => { + const { dispatch, getState } = store; + createNewCanvasEntityFromImage({ imageDTO, type: 'regional_guidance_with_reference_image', dispatch, getState }); + dispatch(sentImageToCanvas()); + dispatch(setActiveTab('canvas')); + imageViewer.close(); + toast({ + id: 'SENT_TO_CANVAS', + title: t('toast.sentToCanvas'), + status: 'success', + }); + }, [imageDTO, imageViewer, store, t]); + return ( }> @@ -104,6 +130,20 @@ export const ImageMenuItemNewLayerFromImageSubMenu = memo(() => { } onClickCapture={onClickNewRasterLayerFromImage} isDisabled={isBusy}> {t('controlLayers.rasterLayer')} + } + onClickCapture={onClickNewRegionalReferenceImageFromImage} + isDisabled={isBusy} + > + {t('controlLayers.referenceImageRegional')} + + } + onClickCapture={onClickNewGlobalReferenceImageFromImage} + isDisabled={isBusy} + > + {t('controlLayers.referenceImageGlobal')} +