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(workbench): dock the preview behind Layers in the Edit rail again

Lincoln Stein54d75e003509
diff --git a/invokeai/frontend/webv2/src/workbench/layoutPresets.test.ts b/invokeai/frontend/webv2/src/workbench/layoutPresets.test.ts
index 80fd7352d4..6b6b48307d 100644
--- a/invokeai/frontend/webv2/src/workbench/layoutPresets.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/layoutPresets.test.ts
@@ -122,8 +122,9 @@ describe('built-in layout preset descriptors', () => {
center: ['canvas', 'preview'],
left: ['generate', 'upscale', 'video'],
panels: { isBottomOpen: false, isLeftOpen: true, isRightOpen: true },
- // The Edit rail is the Layers panel alone; its editors are panes inside it.
- right: ['layers'],
+ // The editors are panes inside the Layers panel; the preview docks
+ // behind Layers so its float/dock surface stays reachable by default.
+ right: ['layers', 'preview'],
},
video: {
active: { bottom: 'gallery:bottom', center: 'preview', left: 'video', right: 'gallery' },
diff --git a/invokeai/frontend/webv2/src/workbench/layoutPresets.ts b/invokeai/frontend/webv2/src/workbench/layoutPresets.ts
index 5765c41fd6..4124f45006 100644
--- a/invokeai/frontend/webv2/src/workbench/layoutPresets.ts
+++ b/invokeai/frontend/webv2/src/workbench/layoutPresets.ts
@@ -212,7 +212,10 @@ export const builtInLayoutPresetDescriptors: BuiltInLayoutPresetDescriptor[] = [
}),
right: createRegion({
activeInstanceId: 'layers',
- instanceIds: ['layers'],
+ // Preview docks behind Layers: the editors are Layers panes, but the
+ // preview is a floatable widget, and its float/dock pair and floated
+ // Invoke control are only reachable where it is actually placed.
+ instanceIds: ['layers', 'preview'],
sizePx: 450,
}),
},
diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
index 967bf828f7..9e29dea142 100644
--- a/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.test.ts
@@ -561,7 +561,7 @@ describe('workbench widget region defaults', () => {
}
});
- it('adopts the Layers-only Edit rail for untouched legacy rails and leaves customized rails alone', () => {
+ it('adopts the shipped Edit rail for untouched legacy rails and leaves customized rails alone', () => {
const initial = createInitialWorkbenchState();
const withRight = (instanceIds: Project['widgetRegions']['right']['instanceIds']): WorkbenchState => ({
...initial,
@@ -574,6 +574,7 @@ describe('workbench widget region defaults', () => {
})),
});
const legacyEditRail = withRight(['layers', 'preview', 'gallery', 'image-map', 'queue']);
+ const layersOnlyRail = withRight(['layers']);
const custom = withRight(['image-map', 'layers']);
const hydratedLegacy = getActiveProject(
@@ -581,7 +582,17 @@ describe('workbench widget region defaults', () => {
);
expect(hydratedLegacy.widgetRegions.right).toMatchObject({
activeInstanceId: 'layers',
- instanceIds: ['layers'],
+ instanceIds: ['layers', 'preview'],
+ });
+
+ // The brief Layers-only rail (which dropped the preview) is a shipped
+ // shape too, so it adopts the current rail and gets the preview back.
+ const hydratedLayersOnly = getActiveProject(
+ workbenchReducer(initial, { state: layersOnlyRail, type: 'hydrateWorkbench' })
+ );
+ expect(hydratedLayersOnly.widgetRegions.right).toMatchObject({
+ activeInstanceId: 'layers',
+ instanceIds: ['layers', 'preview'],
});
const hydratedCustom = getActiveProject(workbenchReducer(initial, { state: custom, type: 'hydrateWorkbench' }));
diff --git a/invokeai/frontend/webv2/src/workbench/workbenchState.ts b/invokeai/frontend/webv2/src/workbench/workbenchState.ts
index 3ff9f36227..73373d5d18 100644
--- a/invokeai/frontend/webv2/src/workbench/workbenchState.ts
+++ b/invokeai/frontend/webv2/src/workbench/workbenchState.ts
@@ -1456,15 +1456,16 @@ const ensureRightRegion = (rightRegion: WidgetRegionState | undefined): WidgetRe
};
/**
- * Every Edit rail this app shipped as a default while the canvas editors were
- * separate widgets: the tabbed rail, and one unreleased build's variant
- * without Image Map. Those editors are panes of the Layers panel now, so an
- * untouched rail of either shape adopts the shipped Layers-only rail; a
+ * Every Edit rail this app shipped as a default: the tabbed rail from while
+ * the canvas editors were separate widgets, one unreleased build's variant
+ * without Image Map, and the brief Layers-only rail that dropped the preview.
+ * An untouched rail of any of those shapes adopts the shipped rail; a
* customized rail stays the user's.
*/
const LEGACY_EDIT_RIGHT_REGION_WIDGET_IDS: ReadonlyArray<readonly WidgetInstanceId[]> = [
['layers', 'preview', 'gallery', 'image-map', 'queue'],
['layers', 'preview', 'gallery', 'queue'],
+ ['layers'],
];
const sameInstanceIds = (region: WidgetRegionState, ids: readonly WidgetInstanceId[]): boolean =>