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.

refactor(webv2): render the compare view on the shared preview stage

joshistoast39adcb7e22b4
diff --git a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewCompare.tsx b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewCompare.tsx
index a84d968a13..d12aa38f27 100644
--- a/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewCompare.tsx
+++ b/invokeai/frontend/webv2/src/workbench/widgets/preview/PreviewCompare.tsx
@@ -18,7 +18,7 @@ import { useTranslation } from 'react-i18next';
import type { PreviewComparisonMode } from './previewSettings';
-import { getFittedFrameCss, previewGridCss } from './PreviewStage';
+import { getFittedFrameCss, PreviewStage } from './PreviewStage';
import { useCompareLoupe, type CompareLoupePane } from './useCompareLoupe';
const COMPARISON_MODES: { labelKey: string; value: PreviewComparisonMode }[] = [
@@ -153,20 +153,11 @@ export const PreviewCompare = ({
return (
<Stack gap="3" h="full" minH="0" w="full">
- <Flex
- align="center"
- backgroundColor="bg.inset"
- color="fg.grid"
- containerType="size"
- css={previewGridCss}
- flex="1"
- justify="center"
- minH="0"
- overflow="hidden"
- p="6"
- w="full"
- >
+ <PreviewStage fill="flex" padding="6">
{mode === 'slider' ? (
+ // Not FittedFrame: this frame needs the drag cursor and pointer-capture
+ // handlers below, and FittedFrame's drop shadow would be a visual change
+ // this Box never had.
<Box
ref={containerRef}
borderColor="border.emphasized"
@@ -231,7 +222,7 @@ export const PreviewCompare = ({
/>
</HStack>
)}
- </Flex>
+ </PreviewStage>
<HStack flexShrink={0} gap="1" justify="center">
<SegmentGroup.Root size="xs" value={mode} onValueChange={handleModeChange}>
<SegmentGroup.Indicator />