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.

fix(webv2): span the preview dot grid across the whole widget

joshistoast2395988ec423
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewCompare.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewCompare.tsx
index 3d3d9c54a1..f829b979e2 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewCompare.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewCompare.tsx
@@ -170,8 +170,6 @@ export const PreviewCompare = ({
<Flex
align="center"
backgroundColor="bg.inset"
- borderWidth="1px"
- borderColor="border.subtle"
color="fg.grid"
containerType="size"
css={previewGridCss}
@@ -180,7 +178,6 @@ export const PreviewCompare = ({
minH="0"
overflow="hidden"
p="6"
- rounded="lg"
w="full"
>
{mode === 'slider' ? (
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFooter.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFooter.tsx
index 4032c1ef02..16b1dcb817 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFooter.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFooter.tsx
@@ -14,6 +14,9 @@ import { PreviewMetadataPanel } from './PreviewMetadataPanel';
* progress) on one quiet row with prev/next, plus the Details expander.
* Identity (board / image name) lives in the widget header; image actions
* live in the header's actions slot — never here.
+ *
+ * It floats over the dot-grid surface rather than partitioning it, so it
+ * carries its own opaque panel fill — the grid runs behind and past it.
*/
export const PreviewFooter = ({
actionImage,
@@ -51,7 +54,7 @@ export const PreviewFooter = ({
: null;
return (
- <Stack borderWidth="1px" borderColor="border.subtle" gap="2" p="3" rounded="lg">
+ <Stack bg="bg.subtle" borderColor="border.subtle" borderWidth="1px" gap="2" minW="0" p="3" rounded="md" shadow="sm">
<HStack align="center" justify="space-between">
<HStack gap="1" minW="0">
<Text color="fg.muted" fontSize="2xs" fontVariantNumeric="tabular-nums" truncate>
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx
index 29f0f08462..cdb1f8f452 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewFrame.tsx
@@ -30,6 +30,11 @@ import { usePreviewLoupe, type PreviewLoupeControls } from './usePreviewLoupe';
* shadowed frame. Owns everything drawn over the image (live badge, and later
* the loupe, progress hairline, and drop-to-compare affordance) so the widget
* shell never grows frame-specific rendering.
+ *
+ * The backdrop is deliberately unframed — no border, no radius, no outer
+ * padding — so the dot grid reads as the widget's own floor and runs edge to
+ * edge. The only framed thing is the media itself; the filmstrip and details
+ * float above the grid rather than sitting in a second card.
*/
export const previewGridCss = {
@@ -69,6 +74,8 @@ interface PreviewFrameProps {
onContextMenu?: (x: number, y: number) => void;
onVideoCopyAvailabilityChange?: (itemKey: GalleryItemKey, isAvailable: boolean) => void;
padding?: string;
+ /** Extra bottom padding reserving room for the overlaid filmstrip and details. */
+ paddingBottom?: string;
shouldAntialiasLiveImage: boolean;
source: PreviewMediaSource | null;
/** Preview-owned controller for the selected video's current frame. */
@@ -88,6 +95,7 @@ export const PreviewFrame = (props: PreviewFrameProps) => {
onContextMenu={props.onContextMenu}
onCopyAvailabilityChange={props.onVideoCopyAvailabilityChange}
padding={props.padding}
+ paddingBottom={props.paddingBottom}
source={props.source}
videoControllerRef={props.videoControllerRef}
/>
@@ -108,6 +116,7 @@ const PreviewImageFrame = ({
loupeControlsRef,
onContextMenu,
padding,
+ paddingBottom,
shouldAntialiasLiveImage,
source,
variant,
@@ -219,8 +228,7 @@ const PreviewImageFrame = ({
<Flex
ref={loupe.stageRefCallback}
align="center"
- borderWidth="1px"
- borderColor="border.subtle"
+ backgroundColor="bg.inset"
color="fg.grid"
containerType="size"
css={previewGridCss}
@@ -230,8 +238,8 @@ const PreviewImageFrame = ({
minH="0"
overflow="hidden"
p={padding}
+ pb={paddingBottom}
position="relative"
- rounded="lg"
w="full"
{...loupe.stageProps}
>
@@ -292,6 +300,7 @@ const PreviewVideo = ({
onContextMenu,
onCopyAvailabilityChange,
padding,
+ paddingBottom,
source,
videoControllerRef,
}: {
@@ -301,6 +310,7 @@ const PreviewVideo = ({
onContextMenu?: (x: number, y: number) => void;
onCopyAvailabilityChange?: (itemKey: GalleryItemKey, isAvailable: boolean) => void;
padding?: string;
+ paddingBottom?: string;
source: Extract<PreviewMediaSource, { kind: 'video' }>;
videoControllerRef?: Ref<PreviewVideoFrameController>;
}) => {
@@ -461,8 +471,7 @@ const PreviewVideo = ({
return (
<Flex
align="center"
- borderWidth="1px"
- borderColor="border.subtle"
+ backgroundColor="bg.inset"
color="fg.grid"
containerType="size"
css={previewGridCss}
@@ -471,8 +480,8 @@ const PreviewVideo = ({
minH="0"
overflow="hidden"
p={padding}
+ pb={paddingBottom}
position="relative"
- rounded="lg"
w="full"
>
<Box
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx
index 1be73164bb..1caee89988 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewWidgetView.tsx
@@ -1,7 +1,7 @@
import type { QueueItem } from '@features/queue/contracts';
import type { WidgetViewProps } from '@workbench/widgetContracts';
-import { Box, SimpleGrid, Stack, Text } from '@chakra-ui/react';
+import { Box, Flex, SimpleGrid, Stack, Text } from '@chakra-ui/react';
import { useDndMonitor, type DragEndEvent } from '@dnd-kit/core';
import {
galleryImages,
@@ -248,6 +248,20 @@ export const getMatchingProgressImage = (
const selectGenerateRecallValues = createGenerateFormValuesSelector();
+/**
+ * Bottom padding the grid surface reserves for the overlaid filmstrip and
+ * details island — their collapsed heights plus the 2-unit inset and gap. An
+ * expanded Details panel grows over the grid on purpose; it is self-capped at
+ * `40cqh` and closes back down.
+ */
+const getPreviewOverlayReserve = (density: PreviewDensity, hasFilmstrip: boolean): string => {
+ if (!hasFilmstrip) {
+ return '5.5rem';
+ }
+
+ return density === 'full' ? '9.75rem' : '8.75rem';
+};
+
export const PreviewWidgetView = ({ region, runtime }: WidgetViewProps) => {
const galleryValues = useActiveProjectSelector((project) => getProjectWidgetValues(project, 'gallery'));
const queueItems = useActiveProjectSelector((project) => project.queue.items);
@@ -835,13 +849,16 @@ export const PreviewWidgetView = ({ region, runtime }: WidgetViewProps) => {
}, [runtime.commands, runtime.hotkeys, selectedItem?.kind, t]);
return (
- <Box ref={rootRef} p="2" h="full">
+ // No padding and no inner card: the dot-grid surface is the widget floor
+ // and runs to every edge. `containerType` anchors the details panel's
+ // `cqh` cap to the widget rather than the viewport.
+ <Box ref={rootRef} containerType="size" h="full" position="relative" w="full">
{/* Single always-mounted keyboard boundary: DOM focus survives swaps
between the live, selected, and compare branches, so arrow
navigation keeps working across them. */}
<Stack
aria-label={t('widgets.labels.preview')}
- gap="3"
+ gap="0"
h="full"
minH="0"
outline="none"
@@ -1029,9 +1046,13 @@ const SelectedMediaPreview = ({
source: Parameters<typeof PreviewFrame>[0]['source'];
}) => {
const { t } = useTranslation();
+ const overlayReserve = getPreviewOverlayReserve(density, filmstripItems !== null);
+ // The grid surface fills; the filmstrip and details float above its lower
+ // edge. The surface reserves matching bottom padding so the fitted media is
+ // never tucked under them — only the dot grid passes behind.
return (
- <Stack gap="2" h="full" minH="0" w="full">
+ <Flex direction="column" h="full" minH="0" position="relative" w="full">
<PreviewFrame
dragItem={dragItem}
frameHeight={frameHeight}
@@ -1042,33 +1063,36 @@ const SelectedMediaPreview = ({
loupeControlsRef={loupeControlsRef}
onVideoCopyAvailabilityChange={onCopyAvailabilityChange}
padding={density === 'full' ? '6' : '3'}
+ paddingBottom={overlayReserve}
shouldAntialiasLiveImage
source={source}
variant="framed"
videoControllerRef={videoControllerRef}
onContextMenu={onContextMenu}
/>
- {filmstripItems ? (
- <PreviewFilmstrip
- density={density}
- items={filmstripItems}
- selectedItemKey={toGalleryItemKey(item)}
- onSelect={onSelectItem}
+ <Stack bottom="2" gap="2" insetX="2" position="absolute" zIndex="1">
+ {filmstripItems ? (
+ <PreviewFilmstrip
+ density={density}
+ items={filmstripItems}
+ selectedItemKey={toGalleryItemKey(item)}
+ onSelect={onSelectItem}
+ />
+ ) : null}
+ <PreviewFooter
+ actionImage={actionImage}
+ actions={actions}
+ boardItemCount={boardItemCount}
+ item={item}
+ isLoadingBoard={isLoadingBoard}
+ isMetadataOpen={isMetadataOpen}
+ selectedIndex={selectedIndex}
+ onNext={onNext}
+ onPrevious={onPrevious}
+ onToggleMetadata={onToggleMetadata}
/>
- ) : null}
- <PreviewFooter
- actionImage={actionImage}
- actions={actions}
- boardItemCount={boardItemCount}
- item={item}
- isLoadingBoard={isLoadingBoard}
- isMetadataOpen={isMetadataOpen}
- selectedIndex={selectedIndex}
- onNext={onNext}
- onPrevious={onPrevious}
- onToggleMetadata={onToggleMetadata}
- />
- </Stack>
+ </Stack>
+ </Flex>
);
};