mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
29 lines
960 B
TypeScript
29 lines
960 B
TypeScript
import type { ButtonGroupProps } from '@invoke-ai/ui-library';
|
|
import { Button, ButtonGroup } from '@invoke-ai/ui-library';
|
|
import { useAppStore } from 'app/store/nanostores/store';
|
|
import { newCanvasFromImage } from 'features/imageActions/actions';
|
|
import { memo, useCallback } from 'react';
|
|
import type { ImageDTO } from 'services/api/types';
|
|
|
|
export const ImageActions = memo(({ imageDTO, ...rest }: { imageDTO: ImageDTO } & ButtonGroupProps) => {
|
|
const { getState, dispatch } = useAppStore();
|
|
|
|
const edit = useCallback(() => {
|
|
newCanvasFromImage({
|
|
imageDTO,
|
|
type: 'raster_layer',
|
|
withInpaintMask: true,
|
|
getState,
|
|
dispatch,
|
|
});
|
|
}, [dispatch, getState, imageDTO]);
|
|
return (
|
|
<ButtonGroup isAttached={false} size="sm" {...rest}>
|
|
<Button onClick={edit} tooltip="Edit parts of this image with Inpainting">
|
|
Edit
|
|
</Button>
|
|
</ButtonGroup>
|
|
);
|
|
});
|
|
ImageActions.displayName = 'ImageActions';
|