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],
|
||||
};
|
||||
|
||||
api.dispatch(rasterLayerAdded({ overrides }));
|
||||
api.dispatch(rasterLayerAdded({ overrides, isSelected: true }));
|
||||
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,
|
||||
PiXBold,
|
||||
} from 'react-icons/pi';
|
||||
import { useChangeImageIsIntermediateMutation } from 'services/api/endpoints/images';
|
||||
|
||||
export const StagingAreaToolbar = memo(() => {
|
||||
const dispatch = useAppDispatch();
|
||||
@ -33,7 +34,7 @@ export const StagingAreaToolbar = memo(() => {
|
||||
return images[session.selectedStagedImageIndex] ?? null;
|
||||
}, [images, session.selectedStagedImageIndex]);
|
||||
const isCanvasActive = useStore(INTERACTION_SCOPES.canvas.$isActive);
|
||||
// const [changeIsImageIntermediate] = useChangeImageIsIntermediateMutation();
|
||||
const [changeIsImageIntermediate] = useChangeImageIsIntermediateMutation();
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
@ -71,18 +72,12 @@ export const StagingAreaToolbar = memo(() => {
|
||||
$shouldShowStagedImage.set(!shouldShowStagedImage);
|
||||
}, [shouldShowStagedImage]);
|
||||
|
||||
const onSaveStagingImage = useCallback(
|
||||
() => {
|
||||
// if (!imageDTO) {
|
||||
// return;
|
||||
// }
|
||||
// changeIsImageIntermediate({ imageDTO, is_intermediate: false });
|
||||
},
|
||||
[
|
||||
// changeIsImageIntermediate,
|
||||
// imageDTO
|
||||
]
|
||||
);
|
||||
const onSaveStagingImage = useCallback(() => {
|
||||
if (!selectedImage) {
|
||||
return;
|
||||
}
|
||||
changeIsImageIntermediate({ imageDTO: selectedImage.imageDTO, is_intermediate: false });
|
||||
}, [changeIsImageIntermediate, selectedImage]);
|
||||
|
||||
useHotkeys(
|
||||
['left'],
|
||||
|
@ -162,7 +162,7 @@ export const imagesApi = api.injectEndpoints({
|
||||
}),
|
||||
invalidatesTags: (result, error, { imageDTO }) => {
|
||||
const categories = getCategories(imageDTO);
|
||||
const boardId = imageDTO.board_id ?? undefined;
|
||||
const boardId = imageDTO.board_id ?? 'none';
|
||||
|
||||
return [
|
||||
{ type: 'Image', id: imageDTO.image_name },
|
||||
@ -557,8 +557,6 @@ export const {
|
||||
useClearIntermediatesMutation,
|
||||
useAddImagesToBoardMutation,
|
||||
useRemoveImagesFromBoardMutation,
|
||||
useAddImageToBoardMutation,
|
||||
useRemoveImageFromBoardMutation,
|
||||
useChangeImageIsIntermediateMutation,
|
||||
useDeleteBoardAndImagesMutation,
|
||||
useDeleteBoardMutation,
|
||||
|
Loading…
Reference in New Issue
Block a user