Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

feat(webv2): thicken the gallery selection border

Josh Corbett3b850151420f
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx
index 888cb23abe..68ee00bfab 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryProgressSection.tsx
@@ -13,19 +13,20 @@ import { useTranslation } from 'react-i18next';
import type { GalleryProgressLayout } from './galleryGridLayout';
+import { SELECTED_TILE_CSS } from './GalleryTileFrame';
import { useGalleryUi } from './GalleryUiContext';
import { useGalleryWidget } from './GalleryWidgetContext';
export const GalleryProgressSection = ({
layout,
getScrollElement,
-}: {
offsetTopPx,
+}: {
layout: GalleryProgressLayout;
getScrollElement(): HTMLDivElement | null;
-}) => {
/** Height of the pinned content above this section in the shared scroll viewport. */
offsetTopPx: number;
+}) => {
const { t } = useTranslation();
const { progressSessions, pinnedProgressSessionId, liveFollowEnabled, followProgressSession } = useGalleryUi();
const { actions, gallery } = useGalleryWidget();
@@ -102,8 +103,8 @@ export const GalleryProgressSection = ({
layout={layout}
fit={gallery.settings.thumbnailFit}
getScrollElement={getScrollElement}
- pinnedSessionId={pinnedProgressSessionId}
offsetTopPx={offsetTopPx}
+ pinnedSessionId={pinnedProgressSessionId}
liveFollowEnabled={liveFollowEnabled}
onFollow={followProgressSession}
restoreFocus={restoreFocus}
@@ -119,8 +120,8 @@ const GalleryProgressGrid = ({
layout,
fit,
getScrollElement,
- pinnedSessionId,
offsetTopPx,
+ pinnedSessionId,
liveFollowEnabled,
onFollow,
restoreFocus,
@@ -129,16 +130,16 @@ const GalleryProgressGrid = ({
layout: GalleryProgressLayout;
fit: GalleryThumbnailFit;
getScrollElement(): HTMLDivElement | null;
- pinnedSessionId: string | null;
offsetTopPx: number;
+ pinnedSessionId: string | null;
liveFollowEnabled: boolean;
onFollow(id: string, options: { revealPreview: boolean }): void;
restoreFocus(): void;
}) => {
const { columns, tileSize, headerHeight, paddingBottom, rowCount, rowHeight } = layout;
const estimateSize = useCallback(() => rowHeight, [rowHeight]);
- const virtualizer = useVirtualizer({
const scrollMargin = offsetTopPx + headerHeight;
+ const virtualizer = useVirtualizer({
count: rowCount,
getScrollElement,
estimateSize,
@@ -231,17 +232,20 @@ const GalleryProgressTile = ({
[restoreFocus]
);
+ const isShownSelected = selected && session.state !== 'queued';
+
return (
<chakra.button
ref={buttonRef}
type="button"
focusVisibleRing="inside"
aria-label={`${label} · ${status}`}
- aria-pressed={selected && session.state !== 'queued'}
+ aria-pressed={isShownSelected}
aria-disabled={session.state !== 'running'}
tabIndex={session.state === 'running' ? 0 : -1}
- borderColor={selected && session.state !== 'queued' ? 'accent.solid' : 'border.subtle'}
- borderWidth="1px"
+ borderColor={isShownSelected ? 'accent.solid' : 'border.subtle'}
+ borderWidth="2px"
+ css={isShownSelected ? SELECTED_TILE_CSS : undefined}
flexShrink={0}
minW="0"
overflow="hidden"
diff --git a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryTileFrame.tsx b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryTileFrame.tsx
index a55084066a..0442197240 100644
--- a/invokeai/frontend/webv2/src/features/gallery/ui/GalleryTileFrame.tsx
+++ b/invokeai/frontend/webv2/src/features/gallery/ui/GalleryTileFrame.tsx
@@ -12,6 +12,19 @@ const TILE_CSS: SystemStyleObject = {
'&:hover .gallery-thumb-overlay, &:focus-within .gallery-thumb-overlay': { opacity: 1 },
};
+/** An inner ring over the image thickens the selected edge without resizing the tile content; shared by every tile. */
+export const SELECTED_TILE_CSS: SystemStyleObject = {
+ _after: {
+ borderRadius: 'sm',
+ boxShadow: 'inset 0 0 0 2px {colors.accent.solid}',
+ content: '""',
+ inset: 0,
+ pointerEvents: 'none',
+ position: 'absolute',
+ zIndex: 1,
+ },
+};
+
const BADGE_TRANSITION = 'opacity var(--wb-motion-duration-medium) ease';
export interface GalleryTileFrameProps extends Omit<BoxProps, 'children'> {
@@ -33,7 +46,10 @@ export const GalleryTileFrame = ({
...boxProps
}: GalleryTileFrameProps) => {
const duration = item.kind === 'video' ? formatGalleryVideoDuration(item.durationSeconds) : null;
- const tileCss = useMemo(() => (css ? [TILE_CSS, css] : TILE_CSS), [css]);
+ const tileCss = useMemo(
+ () => [TILE_CSS, isSelected ? SELECTED_TILE_CSS : undefined, css].filter((entry) => entry !== undefined),
+ [css, isSelected]
+ );
return (
<Box