diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDeletionListeners.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDeletionListeners.ts index 858a8cea0b..d6c284f3c0 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDeletionListeners.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDeletionListeners.ts @@ -15,6 +15,8 @@ import type { ImageDTO } from 'services/api/types'; const log = logger('gallery'); +//TODO(psyche): handle image deletion (canvas sessions?) + // Some utils to delete images from different parts of the app const deleteNodesImages = (state: RootState, dispatch: AppDispatch, imageDTO: ImageDTO) => { state.nodes.present.nodes.forEach((node) => { @@ -49,8 +51,8 @@ const deleteNodesImages = (state: RootState, dispatch: AppDispatch, imageDTO: Im // }; const deleteIPAdapterImages = (state: RootState, dispatch: AppDispatch, imageDTO: ImageDTO) => { - state.canvasV2.ipAdapters.entities.forEach(({ id, imageObject }) => { - if (imageObject?.image.image_name === imageDTO.image_name) { + state.canvasV2.ipAdapters.entities.forEach(({ id, ipAdapter }) => { + if (ipAdapter.image?.image_name === imageDTO.image_name) { dispatch(ipaImageChanged({ id, imageDTO: null })); } }); diff --git a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDropped.ts b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDropped.ts index c2d2cb620d..658b219dbb 100644 --- a/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDropped.ts +++ b/invokeai/frontend/web/src/app/store/middleware/listenerMiddleware/listeners/imageDropped.ts @@ -11,12 +11,7 @@ import type { CanvasControlLayerState, CanvasRasterLayerState } from 'features/c import { imageDTOToImageObject } from 'features/controlLayers/store/types'; import type { TypesafeDraggableData, TypesafeDroppableData } from 'features/dnd/types'; import { isValidDrop } from 'features/dnd/util/isValidDrop'; -import { - imageSelected, - imageToCompareChanged, - isImageViewerOpenChanged, - selectionChanged, -} from 'features/gallery/store/gallerySlice'; +import { imageToCompareChanged, isImageViewerOpenChanged, selectionChanged } from 'features/gallery/store/gallerySlice'; import { fieldImageValueChanged } from 'features/nodes/store/nodesSlice'; import { upscaleInitialImageChanged } from 'features/parameters/store/upscaleSlice'; import { imagesApi } from 'services/api/endpoints/images'; @@ -47,32 +42,6 @@ export const addImageDroppedListener = (startAppListening: AppStartListening) => log.debug({ activeData, overData }, `Unknown payload dropped`); } - /** - * Image dropped on current image - */ - if ( - overData.actionType === 'SET_CURRENT_IMAGE' && - activeData.payloadType === 'IMAGE_DTO' && - activeData.payload.imageDTO - ) { - dispatch(imageSelected(activeData.payload.imageDTO)); - dispatch(isImageViewerOpenChanged(true)); - return; - } - - // /** - // * Image dropped on Control Adapter Layer - // */ - // if ( - // overData.actionType === 'SET_CA_IMAGE' && - // activeData.payloadType === 'IMAGE_DTO' && - // activeData.payload.imageDTO - // ) { - // const { id } = overData.context; - // dispatch(caImageChanged({ id, imageDTO: activeData.payload.imageDTO })); - // return; - // } - /** * Image dropped on IP Adapter Layer */ diff --git a/invokeai/frontend/web/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItemsRasterToControl.tsx b/invokeai/frontend/web/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItemsRasterToControl.tsx index 9513f0409c..57c97b3d87 100644 --- a/invokeai/frontend/web/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItemsRasterToControl.tsx +++ b/invokeai/frontend/web/src/features/controlLayers/components/RasterLayer/RasterLayerMenuItemsRasterToControl.tsx @@ -1,7 +1,6 @@ import { MenuItem } from '@invoke-ai/ui-library'; import { useAppDispatch } from 'app/store/storeHooks'; import { useEntityIdentifierContext } from 'features/controlLayers/contexts/EntityIdentifierContext'; -import { useDefaultControlAdapter } from 'features/controlLayers/hooks/useLayerControlAdapter'; import { rasterLayerConvertedToControlLayer } from 'features/controlLayers/store/canvasV2Slice'; import { memo, useCallback } from 'react'; import { useTranslation } from 'react-i18next'; @@ -12,11 +11,9 @@ export const RasterLayerMenuItemsRasterToControl = memo(() => { const dispatch = useAppDispatch(); const entityIdentifier = useEntityIdentifierContext(); - const defaultControlAdapter = useDefaultControlAdapter(); - const convertRasterLayerToControlLayer = useCallback(() => { - dispatch(rasterLayerConvertedToControlLayer({ id: entityIdentifier.id, controlAdapter: defaultControlAdapter })); - }, [dispatch, defaultControlAdapter, entityIdentifier.id]); + dispatch(rasterLayerConvertedToControlLayer({ id: entityIdentifier.id })); + }, [dispatch, entityIdentifier.id]); return ( }> diff --git a/invokeai/frontend/web/src/features/deleteImageModal/store/selectors.ts b/invokeai/frontend/web/src/features/deleteImageModal/store/selectors.ts index fc6f4b085c..c5491f8bc3 100644 --- a/invokeai/frontend/web/src/features/deleteImageModal/store/selectors.ts +++ b/invokeai/frontend/web/src/features/deleteImageModal/store/selectors.ts @@ -9,28 +9,22 @@ import { isInvocationNode } from 'features/nodes/types/invocation'; import { some } from 'lodash-es'; import type { ImageUsage } from './types'; - +// TODO(psyche): handle image deletion (canvas sessions?) export const getImageUsage = (nodes: NodesState, canvasV2: CanvasV2State, image_name: string) => { - const isLayerImage = canvasV2.rasterLayers.entities.some((layer) => - layer.objects.some((obj) => obj.type === 'image' && obj.image.image_name === image_name) - ); - const isNodesImage = nodes.nodes .filter(isInvocationNode) .some((node) => some(node.data.inputs, (input) => isImageFieldInputInstance(input) && input.value?.image_name === image_name) ); - const isControlAdapterImage = canvasV2.controlLayers.entities.some( - (ca) => ca.imageObject?.image.image_name === image_name || ca.processedImageObject?.image.image_name === image_name + const isIPAdapterImage = canvasV2.ipAdapters.entities.some( + ({ ipAdapter }) => ipAdapter.image?.image_name === image_name ); - const isIPAdapterImage = canvasV2.ipAdapters.entities.some((ipa) => ipa.imageObject?.image.image_name === image_name); - const imageUsage: ImageUsage = { - isLayerImage, + isLayerImage: false, isNodesImage, - isControlAdapterImage, + isControlAdapterImage: false, isIPAdapterImage, };