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.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(canvas): themed bbox overlay, animated staging bar, clearer tooltips
Josh Corbettc097a96589c9
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex b0f4571d33..e9a6fbaebe 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -2793,7 +2793,7 @@"generating": "Generating…","moreAcceptOptions": "More accept options","recall": "Recall settings",- "saveAsDisabledLayer": "Save & Continue",+ "saveAsDisabledLayer": "Keep as Hidden Layer","saveError": "Couldn't save to gallery","saveToGallery": "Save to gallery","saved": "Saved to gallery",diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayFrame.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayFrame.tsindex 5063a9736a..feb4e99849 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayFrame.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayFrame.ts@@ -137,6 +137,8 @@ export const createOverlayFrame = (deps: CreateOverlayFrameDeps): OverlayFrame =bbox: bboxPreview ?? doc.bbox,bboxHandles: activeTool === 'bbox',bboxOverlay: stores.bboxOverlay.get(),+ // The checker's darker square is the theme's canvas surround (`bg.inset`).+ bboxOverlayColor: stores.checkerColors.get().a,cursor: deps.getOverlayCursor(),gradientPreview: stores.gradientPreview.get(),// The grid spans the whole viewport at the bbox snap size when thediff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayRenderer.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayRenderer.tsindex 013e5ac585..4dc7fbad94 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayRenderer.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayRenderer.ts@@ -29,8 +29,10 @@ export const MIN_GRID_SPACING_PX = 8;const BBOX_COLOR = '#3b82f6';const BBOX_DASH: readonly number[] = [4, 4];-/** The bbox-overlay dim fill (legacy `CanvasBboxToolModule` overlayRect parity). */-const BBOX_OVERLAY_FILL = 'hsl(220 12% 10% / 0.8)';+/** The bbox-overlay dim fill when no theme surround color has been fed in. */+const BBOX_OVERLAY_FILL = 'hsl(220 12% 10%)';+/** The shade is the surround color at this opacity: the dimmed area reads as "outside the document". */+const BBOX_OVERLAY_ALPHA = 0.8;const GRID_COLOR = 'rgba(128, 128, 128, 0.25)';const CURSOR_DARK = '#000000';const CURSOR_LIGHT = '#ffffff';@@ -73,6 +75,8 @@ export interface OverlayState {showBbox?: boolean;/** Whether to dim everything outside the bbox (the legacy "bbox overlay" shade). */bboxOverlay?: boolean;+ /** Opaque CSS color for that shade — the theme's canvas surround, resolved by the widget. */+ bboxOverlayColor?: string;/** Whether to draw the rule-of-thirds guides inside the bbox. */ruleOfThirds?: boolean;/** Whether to draw the grid. */@@ -504,10 +508,10 @@ const drawSamGeometry = (ctx: Ctx, state: OverlayState): void => {};/**- * Draws the bbox overlay shade: a translucent dark fill over the ENTIRE viewport+ * Draws the bbox overlay shade: a translucent fill over the ENTIRE viewport* with the bbox region punched out (even-odd fill rule — the two nested rect paths- * cancel inside the bbox), dimming everything outside the generation frame. Fill- * color matches legacy `CanvasBboxToolModule`'s overlayRect.+ * cancel inside the bbox), dimming everything outside the generation frame. The+ * opacity rides `globalAlpha` so the theme color needs no string surgery.*/const drawBboxOverlayShade = (ctx: Ctx, state: OverlayState, target: RasterSurface): void => {if (!state.bboxOverlay) {@@ -515,7 +519,8 @@ const drawBboxOverlayShade = (ctx: Ctx, state: OverlayState, target: RasterSurfa}const bboxScreen = transformBounds(state.view, state.bbox);ctx.save();- ctx.fillStyle = BBOX_OVERLAY_FILL;+ ctx.globalAlpha = BBOX_OVERLAY_ALPHA;+ ctx.fillStyle = state.bboxOverlayColor ?? BBOX_OVERLAY_FILL;ctx.beginPath();ctx.rect(0, 0, target.width, target.height);ctx.rect(bboxScreen.x, bboxScreen.y, bboxScreen.width, bboxScreen.height);diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.browser.test.tsxindex 92a1e67ff6..fe2042e8bf 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.browser.test.tsx@@ -270,7 +270,7 @@ describe('StagingBar thumbnail strip', () => {await interact(() => trigger!.click());const menuItem = Array.from(document.querySelectorAll<HTMLElement>('[role="menuitem"]')).find((item) =>- item.textContent?.includes('Save & Continue')+ item.textContent?.includes('Keep as Hidden Layer'));expect(menuItem).toBeDefined();await interact(() => menuItem!.click());diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsxindex aff668d7d3..45000651a8 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/StagingBar.tsx@@ -139,7 +139,9 @@ export const StagingBar = ({};return (- <Stack align="center" gap="2" w="full">+ // The bar mounts when staging begins; a short slide-fade lands it instead+ // of popping it in. Duration collapses under reduce-motion with the theme.+ <Stack align="center" animationDuration="moderate" animationName="slide-from-bottom, fade-in" gap="2" w="full">{contextMenuTarget ? (<StagingItemContextMenucanAccept={canAccept}diff --git a/invokeai/frontend/webv2/src/workbench/widgets/canvas/ToolStripFlyout.tsx b/invokeai/frontend/webv2/src/workbench/widgets/canvas/ToolStripFlyout.tsxindex 6c5fe64396..81a3ac35a2 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/canvas/ToolStripFlyout.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/canvas/ToolStripFlyout.tsx@@ -7,6 +7,8 @@ import { useCallback, useEffect, useRef, useState } from 'react';const HOLD_OPEN_MS = 350;const TOOLTIP_POSITIONING = { placement: 'right' } as const;+/** The flyout opens sideways, so a subtool's tooltip goes below it rather than over the next subtool. */+const SUBTOOL_TOOLTIP_POSITIONING = { placement: 'bottom' } as const;export interface ToolFlyoutItem {id: string;@@ -297,7 +299,7 @@ const FlyoutItem = ({}) => {const onClick = useCallback(() => onSelect(item.id), [item.id, onSelect]);return (- <Tooltip content={item.label} positioning={TOOLTIP_POSITIONING}>+ <Tooltip content={item.label} positioning={SUBTOOL_TOOLTIP_POSITIONING}><IconButtonaria-checked={checked}aria-label={item.label}