Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions invokeai/frontend/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@observ33r/object-equals": "^1.1.5",
"@reduxjs/toolkit": "2.8.2",
"@roarr/browser-log-writer": "^1.3.0",
"@virtuoso.dev/masonry": "1.3.5",
"@xyflow/react": "^12.8.2",
"ag-psd": "^28.2.2",
"async-mutex": "^0.5.0",
Expand Down
26 changes: 26 additions & 0 deletions invokeai/frontend/web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions invokeai/frontend/web/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,11 @@
"exitSearch": "Exit Image Search",
"featuresWillReset": "If you delete this image, those features will immediately be reset.",
"galleryImageSize": "Image Size",
"galleryLayout": "Layout",
"galleryLayoutGrid": "Grid",
"galleryLayoutGridTooltip": "Grid layout. Paged gallery uses grid.",
"galleryLayoutMasonry": "Masonry",
"galleryLayoutMasonryTooltip": "Masonry layout. Turns off paged gallery.",
"gallerySettings": "Gallery Settings",
"go": "Go",
"image": "image",
Expand All @@ -551,6 +556,7 @@
"sortDirection": "Sort Direction",
"showStarredImagesFirst": "Show Starred Images First",
"usePagedGalleryView": "Use Paged Gallery View",
"usePagedGalleryViewTooltip": "Paged gallery uses the grid layout. Choosing masonry turns this off.",
"noImageSelected": "No Image Selected",
"noImagesInGallery": "No Images to Display",
"starImage": "Star",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Box, Flex, forwardRef, Grid, GridItem, Spinner, Text } from '@invoke-ai/ui-library';
import { createSelector } from '@reduxjs/toolkit';
import { useAppSelector, useAppStore } from 'app/store/storeHooks';
import { getFocusedRegion, useIsRegionFocused } from 'common/hooks/focus';
import { getFocusedRegion } from 'common/hooks/focus';
import { useGalleryStarImageHotkey } from 'features/gallery/hooks/useGalleryStarImageHotkey';
import { useRangeBasedImageFetching } from 'features/gallery/hooks/useRangeBasedImageFetching';
import type { selectGetImageNamesQueryArgs } from 'features/gallery/store/gallerySelectors';
import {
selectGalleryImageMinimumWidth,
selectImageToCompare,
selectLastSelectedItem,
selectSelection,
selectSelectionCount,
} from 'features/gallery/store/gallerySelectors';
import { imageToCompareChanged, selectionChanged } from 'features/gallery/store/gallerySlice';
import { useRegisteredHotkeys } from 'features/system/components/HotkeysModal/useHotkeyData';
Expand All @@ -28,7 +28,7 @@ import type {
VirtuosoGridHandle,
} from 'react-virtuoso';
import { VirtuosoGrid } from 'react-virtuoso';
import { imagesApi, useImageDTO, useStarImagesMutation, useUnstarImagesMutation } from 'services/api/endpoints/images';
import { imagesApi } from 'services/api/endpoints/images';
import { useDebounce } from 'use-debounce';

import { getItemIndex } from './getItemIndex';
Expand Down Expand Up @@ -306,37 +306,6 @@ const useKeepSelectedImageInView = (
}, [imageNames, rangeRef, rootRef, virtuosoRef, selection]);
};

const useStarImageHotkey = () => {
const lastSelectedItem = useAppSelector(selectLastSelectedItem);
const selectionCount = useAppSelector(selectSelectionCount);
const isGalleryFocused = useIsRegionFocused('gallery');
const imageDTO = useImageDTO(lastSelectedItem);
const [starImages] = useStarImagesMutation();
const [unstarImages] = useUnstarImagesMutation();

const handleStarHotkey = useCallback(() => {
if (!imageDTO) {
return;
}
if (!isGalleryFocused) {
return;
}
if (imageDTO.starred) {
unstarImages({ image_names: [imageDTO.image_name] });
} else {
starImages({ image_names: [imageDTO.image_name] });
}
}, [imageDTO, isGalleryFocused, starImages, unstarImages]);

useRegisteredHotkeys({
id: 'starImage',
category: 'gallery',
callback: handleStarHotkey,
options: { enabled: !!imageDTO && selectionCount === 1 && isGalleryFocused },
dependencies: [imageDTO, selectionCount, isGalleryFocused, handleStarHotkey],
});
};

type GalleryImageGridContentProps = {
imageNames: string[];
navigationImageNames?: string[];
Expand All @@ -359,7 +328,7 @@ export const GalleryImageGridContent = memo(
enabled: !isLoading,
});

useStarImageHotkey();
useGalleryStarImageHotkey();
useKeepSelectedImageInView(imageNames, virtuosoRef, rootRef, rangeRef);
useKeyboardNavigation(navigationImageNames ?? imageNames, virtuosoRef, rootRef);
const scrollerRef = useScrollableGallery(rootRef);
Expand Down
Loading
Loading