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
style(ui): tighten the gap between list rows to 2px
Josh Corbetta373fb068d1e
diff --git a/invokeai/frontend/webv2/src/platform/ui/list/List.browser.test.tsx b/invokeai/frontend/webv2/src/platform/ui/list/List.browser.test.tsxindex 2249aa596f..be7013fb6a 100644--- a/invokeai/frontend/webv2/src/platform/ui/list/List.browser.test.tsx+++ b/invokeai/frontend/webv2/src/platform/ui/list/List.browser.test.tsx@@ -11,6 +11,7 @@ import type { ListRow } from './listRows';import { List, type ListRowProps } from './List';import { ListItem } from './ListItem';+import { LIST_ROW_GAP_PX } from './listLayout';import { listRowsFromSections } from './listRows';vi.mock('react-i18next', () => ({@@ -27,7 +28,8 @@ interface Item {}const HEADER_PX = 32;-const ROW_PX = 56;+/** A comfortable row's slot: its 52px item plus the row gap. */+const ROW_PX = 52 + LIST_ROW_GAP_PX;const section = (key: string, label: string, count: number): { items: Item[]; key: string; label: string } => ({items: Array.from({ length: count }, (_, index) => ({ id: `${key}-${index}`, name: `${label} ${index}` })),@@ -459,9 +461,9 @@ describe('List measured rows', () => {await settleFrame();const top = (id: string) => host.querySelector<HTMLElement>(`[data-testid="${id}"]`)!.getBoundingClientRect().top;- // Each slot is its content plus the 4px gap: the tall row's successor sits 124px below it, a short one 34px.- expect(top('main-2') - top('main-1')).toBeCloseTo(124, 0);- expect(top('main-3') - top('main-2')).toBeCloseTo(34, 0);+ // Each slot is its content plus the row gap.+ expect(top('main-2') - top('main-1')).toBeCloseTo(120 + LIST_ROW_GAP_PX, 0);+ expect(top('main-3') - top('main-2')).toBeCloseTo(30 + LIST_ROW_GAP_PX, 0);// A row that grows after mount (an editor adding a line) pushes the rows after it down.const before = top('main-3') - top('main-2');@@ -514,9 +516,9 @@ describe('List measured rows', () => {);await settleFrame();await settleFrame();- expect(top('main-3') - top('main-2')).toBeCloseTo(34, 0);+ expect(top('main-3') - top('main-2')).toBeCloseTo(30 + LIST_ROW_GAP_PX, 0);- const loraHeaderTop = HEADER_PX + 120 + 4 + 11 * 34;+ const loraHeaderTop = HEADER_PX + 120 + LIST_ROW_GAP_PX + 11 * (30 + LIST_ROW_GAP_PX);await scrollTo(loraHeaderTop - HEADER_PX / 2);expect(pinnedHeader()?.textContent).toContain('Main');diff --git a/invokeai/frontend/webv2/src/platform/ui/list/ListChrome.browser.test.tsx b/invokeai/frontend/webv2/src/platform/ui/list/ListChrome.browser.test.tsxindex 806613fff4..b65a2a93fa 100644--- a/invokeai/frontend/webv2/src/platform/ui/list/ListChrome.browser.test.tsx+++ b/invokeai/frontend/webv2/src/platform/ui/list/ListChrome.browser.test.tsx@@ -7,6 +7,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { List, type ListRowProps } from './List';import { ListItem } from './ListItem';+import { LIST_ROW_GAP_PX } from './listLayout';import { ListPager } from './ListPager';import { listRowsFromItems, listRowsFromSections } from './listRows';import { ListSelectionBar } from './ListSelectionBar';@@ -164,8 +165,8 @@ describe('list dividers', () => {const line = lines[0]!.getBoundingClientRect();// The row gap is unchanged by the divider, which sits in its middle.- expect(second.top - first.bottom).toBeCloseTo(4, 0);- expect(line.top - first.bottom).toBeCloseTo(1.5, 0);+ expect(second.top - first.bottom).toBeCloseTo(LIST_ROW_GAP_PX, 0);+ expect(line.top - first.bottom).toBeCloseTo((LIST_ROW_GAP_PX - 1) / 2, 0);// Inset from both edges so rounded row corners never touch it.expect(line.left - first.left).toBeCloseTo(8, 0);expect(first.right - line.right).toBeCloseTo(8, 0);@@ -210,8 +211,8 @@ describe('list dividers', () => {const line = hairlines()[0]!.getBoundingClientRect();// Same geometry as stacked rows: centred in the gap, inset from both row edges.- expect(rowB.top - rowA.bottom).toBeCloseTo(4, 0);- expect(line.top - rowA.bottom).toBeCloseTo(1.5, 0);+ expect(rowB.top - rowA.bottom).toBeCloseTo(LIST_ROW_GAP_PX, 0);+ expect(line.top - rowA.bottom).toBeCloseTo((LIST_ROW_GAP_PX - 1) / 2, 0);expect(line.left - rowA.left).toBeCloseTo(8, 0);expect(rowA.right - line.right).toBeCloseTo(8, 0);});diff --git a/invokeai/frontend/webv2/src/platform/ui/list/listLayout.ts b/invokeai/frontend/webv2/src/platform/ui/list/listLayout.tsindex f91333f630..6286ceb1df 100644--- a/invokeai/frontend/webv2/src/platform/ui/list/listLayout.ts+++ b/invokeai/frontend/webv2/src/platform/ui/list/listLayout.ts@@ -7,8 +7,8 @@ const LIST_CHECK_PADDING = '0.5rem';/** Where row checkboxes start relative to the list's edge, so chrome above the list can line up with them. */export const LIST_CHECK_INSET = `calc(${LIST_ROW_INSET} + ${LIST_CHECK_PADDING})`;-/** Space between rows; a divider, when shown, sits centred in it. */-export const LIST_ROW_GAP_PX = 4;+/** A narrow gap between rows; a divider, when shown, sits centred in it. */+export const LIST_ROW_GAP_PX = 2;/** Dividers stop short of the row edges so a filled row's rounded corners never meet the line. */export const LIST_DIVIDER_INSET = '0.5rem';