mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): staging area actions
This commit is contained in:
parent
cb97969bbc
commit
10a5452df9
@ -67,7 +67,7 @@ export const addStagingListeners = (startAppListening: AppStartListening) => {
|
|||||||
objects: [imageObject],
|
objects: [imageObject],
|
||||||
};
|
};
|
||||||
|
|
||||||
api.dispatch(rasterLayerAdded({ overrides }));
|
api.dispatch(rasterLayerAdded({ overrides, isSelected: true }));
|
||||||
api.dispatch(sessionStagingAreaReset());
|
api.dispatch(sessionStagingAreaReset());
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
import { Button } from '@invoke-ai/ui-library';
|
|
||||||
import { useAppDispatch } from 'app/store/storeHooks';
|
|
||||||
import { allEntitiesDeleted } from 'features/controlLayers/store/canvasV2Slice';
|
|
||||||
import { memo, useCallback } from 'react';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import { PiTrashSimpleBold } from 'react-icons/pi';
|
|
||||||
|
|
||||||
export const ResetAllEntitiesButton = memo(() => {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const dispatch = useAppDispatch();
|
|
||||||
const onClick = useCallback(() => {
|
|
||||||
dispatch(allEntitiesDeleted());
|
|
||||||
}, [dispatch]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Button
|
|
||||||
onClick={onClick}
|
|
||||||
leftIcon={<PiTrashSimpleBold />}
|
|
||||||
variant="ghost"
|
|
||||||
colorScheme="error"
|
|
||||||
data-testid="control-layers-delete-all-layers-button"
|
|
||||||
>
|
|
||||||
{t('controlLayers.resetAll')}
|
|
||||||
</Button>
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
ResetAllEntitiesButton.displayName = 'ResetAllEntitiesButton';
|
|
@ -23,6 +23,7 @@ import {
|
|||||||
PiTrashSimpleBold,
|
PiTrashSimpleBold,
|
||||||
PiXBold,
|
PiXBold,
|
||||||
} from 'react-icons/pi';
|
} from 'react-icons/pi';
|
||||||
|
import { useChangeImageIsIntermediateMutation } from 'services/api/endpoints/images';
|
||||||
|
|
||||||
export const StagingAreaToolbar = memo(() => {
|
export const StagingAreaToolbar = memo(() => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
@ -33,7 +34,7 @@ export const StagingAreaToolbar = memo(() => {
|
|||||||
return images[session.selectedStagedImageIndex] ?? null;
|
return images[session.selectedStagedImageIndex] ?? null;
|
||||||
}, [images, session.selectedStagedImageIndex]);
|
}, [images, session.selectedStagedImageIndex]);
|
||||||
const isCanvasActive = useStore(INTERACTION_SCOPES.canvas.$isActive);
|
const isCanvasActive = useStore(INTERACTION_SCOPES.canvas.$isActive);
|
||||||
// const [changeIsImageIntermediate] = useChangeImageIsIntermediateMutation();
|
const [changeIsImageIntermediate] = useChangeImageIsIntermediateMutation();
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@ -71,18 +72,12 @@ export const StagingAreaToolbar = memo(() => {
|
|||||||
$shouldShowStagedImage.set(!shouldShowStagedImage);
|
$shouldShowStagedImage.set(!shouldShowStagedImage);
|
||||||
}, [shouldShowStagedImage]);
|
}, [shouldShowStagedImage]);
|
||||||
|
|
||||||
const onSaveStagingImage = useCallback(
|
const onSaveStagingImage = useCallback(() => {
|
||||||
() => {
|
if (!selectedImage) {
|
||||||
// if (!imageDTO) {
|
return;
|
||||||
// return;
|
}
|
||||||
// }
|
changeIsImageIntermediate({ imageDTO: selectedImage.imageDTO, is_intermediate: false });
|
||||||
// changeIsImageIntermediate({ imageDTO, is_intermediate: false });
|
}, [changeIsImageIntermediate, selectedImage]);
|
||||||
},
|
|
||||||
[
|
|
||||||
// changeIsImageIntermediate,
|
|
||||||
// imageDTO
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
useHotkeys(
|
useHotkeys(
|
||||||
['left'],
|
['left'],
|
||||||
|
@ -162,7 +162,7 @@ export const imagesApi = api.injectEndpoints({
|
|||||||
}),
|
}),
|
||||||
invalidatesTags: (result, error, { imageDTO }) => {
|
invalidatesTags: (result, error, { imageDTO }) => {
|
||||||
const categories = getCategories(imageDTO);
|
const categories = getCategories(imageDTO);
|
||||||
const boardId = imageDTO.board_id ?? undefined;
|
const boardId = imageDTO.board_id ?? 'none';
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{ type: 'Image', id: imageDTO.image_name },
|
{ type: 'Image', id: imageDTO.image_name },
|
||||||
@ -557,8 +557,6 @@ export const {
|
|||||||
useClearIntermediatesMutation,
|
useClearIntermediatesMutation,
|
||||||
useAddImagesToBoardMutation,
|
useAddImagesToBoardMutation,
|
||||||
useRemoveImagesFromBoardMutation,
|
useRemoveImagesFromBoardMutation,
|
||||||
useAddImageToBoardMutation,
|
|
||||||
useRemoveImageFromBoardMutation,
|
|
||||||
useChangeImageIsIntermediateMutation,
|
useChangeImageIsIntermediateMutation,
|
||||||
useDeleteBoardAndImagesMutation,
|
useDeleteBoardAndImagesMutation,
|
||||||
useDeleteBoardMutation,
|
useDeleteBoardMutation,
|
||||||
|
Loading…
Reference in New Issue
Block a user