mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
only show delete icon if big enough
This commit is contained in:
parent
405054d802
commit
984121d682
@ -23,9 +23,11 @@ export const makeSelector = (image_name: string) =>
|
|||||||
({ gallery }) => {
|
({ gallery }) => {
|
||||||
const isSelected = gallery.selection.includes(image_name);
|
const isSelected = gallery.selection.includes(image_name);
|
||||||
const selectionCount = gallery.selection.length;
|
const selectionCount = gallery.selection.length;
|
||||||
|
const galleryImageMinimumWidth = gallery.galleryImageMinimumWidth;
|
||||||
return {
|
return {
|
||||||
isSelected,
|
isSelected,
|
||||||
selectionCount,
|
selectionCount,
|
||||||
|
galleryImageMinimumWidth,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
defaultSelectorOptions
|
defaultSelectorOptions
|
||||||
@ -44,7 +46,8 @@ const GalleryImage = (props: HoverableImageProps) => {
|
|||||||
|
|
||||||
const localSelector = useMemo(() => makeSelector(image_name), [image_name]);
|
const localSelector = useMemo(() => makeSelector(image_name), [image_name]);
|
||||||
|
|
||||||
const { isSelected, selectionCount } = useAppSelector(localSelector);
|
const { isSelected, selectionCount, galleryImageMinimumWidth } =
|
||||||
|
useAppSelector(localSelector);
|
||||||
|
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
@ -113,7 +116,9 @@ const GalleryImage = (props: HoverableImageProps) => {
|
|||||||
draggableData={draggableData}
|
draggableData={draggableData}
|
||||||
isSelected={isSelected}
|
isSelected={isSelected}
|
||||||
minSize={0}
|
minSize={0}
|
||||||
onClickReset={handleDelete}
|
onClickReset={
|
||||||
|
galleryImageMinimumWidth > 60 ? handleDelete : undefined
|
||||||
|
}
|
||||||
resetIcon={<FaTrash />}
|
resetIcon={<FaTrash />}
|
||||||
resetTooltip="Delete image"
|
resetTooltip="Delete image"
|
||||||
imageSx={{ w: 'full', h: 'full' }}
|
imageSx={{ w: 'full', h: 'full' }}
|
||||||
|
Loading…
Reference in New Issue
Block a user