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): ordered raster adjustment stacks as layer child rows
Josh Corbett1694c69ce126
diff --git a/invokeai/frontend/webv2/performance/architecture-baseline.json b/invokeai/frontend/webv2/performance/architecture-baseline.jsonindex fa1ab9a9a6..4c3f9d61ae 100644--- a/invokeai/frontend/webv2/performance/architecture-baseline.json+++ b/invokeai/frontend/webv2/performance/architecture-baseline.json@@ -2,15 +2,15 @@"build": {"launchpad": {"baseline": {- "brotliBytes": 841493,+ "brotliBytes": 841126,"cssRawBytes": 2159,"fontRawBytes": 219480,- "gzipBytes": 840019,+ "gzipBytes": 840009,"imageRawBytes": 156376,- "initialRawBytes": 1957790,+ "initialRawBytes": 1958397,"largestAssetRawBytes": 746376,"otherAssetRawBytes": 0,- "ownedRawBytes": 70892,+ "ownedRawBytes": 70895,"requestCount": 42,"scriptRequestCount": 26,"sourceOwners": [@@ -291,15 +291,15 @@]},"limits": {- "brotliBytes": 849908,+ "brotliBytes": 849538,"cssRawBytes": 2181,"fontRawBytes": 221675,- "gzipBytes": 848420,+ "gzipBytes": 848410,"imageRawBytes": 157940,- "initialRawBytes": 1977368,+ "initialRawBytes": 1977981,"largestAssetRawBytes": 753840,"otherAssetRawBytes": 0,- "ownedRawBytes": 70892,+ "ownedRawBytes": 70895,"requestCount": 42,"scriptRequestCount": 26},@@ -309,15 +309,15 @@},"editor": {"baseline": {- "brotliBytes": 1100667,+ "brotliBytes": 1100278,"cssRawBytes": 2159,"fontRawBytes": 219480,- "gzipBytes": 1095727,+ "gzipBytes": 1095705,"imageRawBytes": 156376,- "initialRawBytes": 2744326,+ "initialRawBytes": 2745741,"largestAssetRawBytes": 746376,"otherAssetRawBytes": 0,- "ownedRawBytes": 114600,+ "ownedRawBytes": 114602,"requestCount": 97,"scriptRequestCount": 81,"sourceOwners": [@@ -933,15 +933,15 @@]},"limits": {- "brotliBytes": 1111674,+ "brotliBytes": 1111281,"cssRawBytes": 2181,"fontRawBytes": 221675,- "gzipBytes": 1106685,+ "gzipBytes": 1106663,"imageRawBytes": 157940,- "initialRawBytes": 2771770,+ "initialRawBytes": 2773199,"largestAssetRawBytes": 753840,"otherAssetRawBytes": 0,- "ownedRawBytes": 114600,+ "ownedRawBytes": 114602,"requestCount": 97,"scriptRequestCount": 81},diff --git a/invokeai/frontend/webv2/performance/browser-baseline.json b/invokeai/frontend/webv2/performance/browser-baseline.jsonindex 750c5ec3ae..4e364e812c 100644--- a/invokeai/frontend/webv2/performance/browser-baseline.json+++ b/invokeai/frontend/webv2/performance/browser-baseline.json@@ -25,13 +25,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 125.90000000596046,+ "domContentLoadedMedianMs": 125.89999999850988,"id": "launchpad","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 126,- "longestTaskMaxMs": 75,+ "loadMedianMs": 126.10000000149012,+ "longestTaskMaxMs": 78,"owner": "app","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:launchpad",@@ -41,24 +41,24 @@"fontRawBytes": 23664,"imageRawBytes": 0,"largestAssetRawBytes": 746376,- "otherRawBytes": 158414,+ "otherRawBytes": 158619,"requestCount": 38,- "scriptRawBytes": 1633815,+ "scriptRawBytes": 1634420,"scriptRequestCount": 34,- "totalRawBytes": 1818052+ "totalRawBytes": 1818862},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 0,"largestAssetRawBytes": 753840,- "otherRawBytes": 159999,+ "otherRawBytes": 160206,"requestCount": 38,- "scriptRawBytes": 1650154,+ "scriptRawBytes": 1650765,"scriptRequestCount": 34,- "totalRawBytes": 1836233+ "totalRawBytes": 1837051},- "routeReadyMedianMs": 275.30000000447035,+ "routeReadyMedianMs": 283.3999999985099,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "empty"},@@ -85,13 +85,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 123.80000000447035,+ "domContentLoadedMedianMs": 123.10000000149012,"id": "launchpad","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 123.80000000447035,- "longestTaskMaxMs": 73,+ "loadMedianMs": 123.29999999701977,+ "longestTaskMaxMs": 71,"owner": "app","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:launchpad",@@ -101,24 +101,24 @@"fontRawBytes": 23664,"imageRawBytes": 0,"largestAssetRawBytes": 746376,- "otherRawBytes": 158414,+ "otherRawBytes": 158619,"requestCount": 38,- "scriptRawBytes": 1633815,+ "scriptRawBytes": 1634420,"scriptRequestCount": 34,- "totalRawBytes": 1818052+ "totalRawBytes": 1818862},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 0,"largestAssetRawBytes": 753840,- "otherRawBytes": 159999,+ "otherRawBytes": 160206,"requestCount": 38,- "scriptRawBytes": 1650154,+ "scriptRawBytes": 1650765,"scriptRequestCount": 34,- "totalRawBytes": 1836233+ "totalRawBytes": 1837051},- "routeReadyMedianMs": 293,+ "routeReadyMedianMs": 292.19999999552965,"scriptSourceOwnerSet": "launchpad-static","stateProfile": "representative"},@@ -145,15 +145,15 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 124.39999999850988,+ "domContentLoadedMedianMs": 122.60000000149012,"id": "editor-minimal","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 124.5,- "longestTaskMaxMs": 106,+ "loadMedianMs": 122.80000000447035,+ "longestTaskMaxMs": 104,"owner": "workbench",- "projectSwitchMedianMs": 41.100000001490116,+ "projectSwitchMedianMs": 40.20000000298023,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -161,24 +161,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158414,+ "otherRawBytes": 158619,"requestCount": 115,- "scriptRawBytes": 3265821,+ "scriptRawBytes": 3267315,"scriptRequestCount": 110,- "totalRawBytes": 3606434+ "totalRawBytes": 3608133},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 159999,+ "otherRawBytes": 160206,"requestCount": 115,- "scriptRawBytes": 3298480,+ "scriptRawBytes": 3299989,"scriptRequestCount": 110,- "totalRawBytes": 3642499+ "totalRawBytes": 3644215},- "routeReadyMedianMs": 690.8999999985099,+ "routeReadyMedianMs": 684,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -205,15 +205,15 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 124.79999999701977,+ "domContentLoadedMedianMs": 121.29999999701977,"id": "editor-minimal","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,"layoutSwitchMedianMs": 0,- "loadMedianMs": 124.89999999850988,- "longestTaskMaxMs": 203,+ "loadMedianMs": 121.5,+ "longestTaskMaxMs": 198,"owner": "workbench",- "projectSwitchMedianMs": 78.29999999701977,+ "projectSwitchMedianMs": 79.79999999701977,"readyMark": "invokeai:ready:widget:center:preview","remediationTicket": "deepen-widget-registry-loading","resourceBaseline": {@@ -221,24 +221,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158414,+ "otherRawBytes": 158619,"requestCount": 115,- "scriptRawBytes": 3265821,+ "scriptRawBytes": 3267315,"scriptRequestCount": 110,- "totalRawBytes": 3606434+ "totalRawBytes": 3608133},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 159999,+ "otherRawBytes": 160206,"requestCount": 115,- "scriptRawBytes": 3298480,+ "scriptRawBytes": 3299989,"scriptRequestCount": 110,- "totalRawBytes": 3642499+ "totalRawBytes": 3644215},- "routeReadyMedianMs": 478.20000000298023,+ "routeReadyMedianMs": 473,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"},@@ -247,31 +247,31 @@"cssRawBytes": 0,"fontRawBytes": 0,"imageRawBytes": 0,- "largestAssetRawBytes": 268619,+ "largestAssetRawBytes": 271870,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 424961,+ "scriptRawBytes": 429522,"scriptRequestCount": 7,- "totalRawBytes": 424961+ "totalRawBytes": 429522},"activatedResourceLimits": {"cssRawBytes": 0,"fontRawBytes": 0,"imageRawBytes": 0,- "largestAssetRawBytes": 271306,+ "largestAssetRawBytes": 274589,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 429211,+ "scriptRawBytes": 433818,"scriptRequestCount": 7,- "totalRawBytes": 429211+ "totalRawBytes": 433818},- "domContentLoadedMedianMs": 121.70000000298023,+ "domContentLoadedMedianMs": 120.70000000298023,"id": "editor-canvas",- "layoutAckMedianMs": 2.399999998509884,- "layoutReturnSwitchMedianMs": 56.899999998509884,- "layoutSwitchMedianMs": 99.10000000149012,- "loadMedianMs": 121.79999999701977,- "longestTaskMaxMs": 132,+ "layoutAckMedianMs": 2.5,+ "layoutReturnSwitchMedianMs": 59,+ "layoutSwitchMedianMs": 94,+ "loadMedianMs": 120.89999999850988,+ "longestTaskMaxMs": 135,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -281,24 +281,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158414,+ "otherRawBytes": 158619,"requestCount": 122,- "scriptRawBytes": 3690782,+ "scriptRawBytes": 3696837,"scriptRequestCount": 117,- "totalRawBytes": 4031395+ "totalRawBytes": 4037655},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 159999,+ "otherRawBytes": 160206,"requestCount": 122,- "scriptRawBytes": 3727690,+ "scriptRawBytes": 3733806,"scriptRequestCount": 117,- "totalRawBytes": 4071709+ "totalRawBytes": 4078032},- "routeReadyMedianMs": 1071,+ "routeReadyMedianMs": 1070.7999999970198,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "empty"},@@ -307,31 +307,31 @@"cssRawBytes": 0,"fontRawBytes": 0,"imageRawBytes": 0,- "largestAssetRawBytes": 268619,+ "largestAssetRawBytes": 271870,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 424961,+ "scriptRawBytes": 429522,"scriptRequestCount": 7,- "totalRawBytes": 424961+ "totalRawBytes": 429522},"activatedResourceLimits": {"cssRawBytes": 0,"fontRawBytes": 0,"imageRawBytes": 0,- "largestAssetRawBytes": 271306,+ "largestAssetRawBytes": 274589,"otherRawBytes": 0,"requestCount": 7,- "scriptRawBytes": 429211,+ "scriptRawBytes": 433818,"scriptRequestCount": 7,- "totalRawBytes": 429211+ "totalRawBytes": 433818},- "domContentLoadedMedianMs": 121.40000000596046,+ "domContentLoadedMedianMs": 120.80000000447035,"id": "editor-canvas",- "layoutAckMedianMs": 2.600000001490116,- "layoutReturnSwitchMedianMs": 50.600000001490116,- "layoutSwitchMedianMs": 92.30000000447035,- "loadMedianMs": 121.60000000149012,- "longestTaskMaxMs": 205,+ "layoutAckMedianMs": 3,+ "layoutReturnSwitchMedianMs": 49,+ "layoutSwitchMedianMs": 90.5,+ "loadMedianMs": 120.89999999850988,+ "longestTaskMaxMs": 197,"owner": "canvas","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:canvas",@@ -341,24 +341,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158414,+ "otherRawBytes": 158619,"requestCount": 122,- "scriptRawBytes": 3690782,+ "scriptRawBytes": 3696837,"scriptRequestCount": 117,- "totalRawBytes": 4031395+ "totalRawBytes": 4037655},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 159999,+ "otherRawBytes": 160206,"requestCount": 122,- "scriptRawBytes": 3727690,+ "scriptRawBytes": 3733806,"scriptRequestCount": 117,- "totalRawBytes": 4071709+ "totalRawBytes": 4078032},- "routeReadyMedianMs": 1209,+ "routeReadyMedianMs": 1200.8999999985099,"scriptSourceOwnerSet": "editor-canvas-static","stateProfile": "representative"},@@ -385,13 +385,13 @@"scriptRequestCount": 6,"totalRawBytes": 383447},- "domContentLoadedMedianMs": 122.60000000149012,+ "domContentLoadedMedianMs": 123.39999999850988,"id": "editor-workflow",- "layoutAckMedianMs": 2.2999999970197678,- "layoutReturnSwitchMedianMs": 35.5,- "layoutSwitchMedianMs": 93.40000000596046,- "loadMedianMs": 122.80000000447035,- "longestTaskMaxMs": 104,+ "layoutAckMedianMs": 3,+ "layoutReturnSwitchMedianMs": 36,+ "layoutSwitchMedianMs": 88.70000000298023,+ "loadMedianMs": 123.5,+ "longestTaskMaxMs": 101,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -401,24 +401,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158414,+ "otherRawBytes": 158619,"requestCount": 122,- "scriptRawBytes": 3630058,+ "scriptRawBytes": 3631552,"scriptRequestCount": 116,- "totalRawBytes": 3986084+ "totalRawBytes": 3987783},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 159999,+ "otherRawBytes": 160206,"requestCount": 122,- "scriptRawBytes": 3666359,+ "scriptRawBytes": 3667868,"scriptRequestCount": 116,- "totalRawBytes": 4025945+ "totalRawBytes": 4027661},- "routeReadyMedianMs": 1060.2999999970198,+ "routeReadyMedianMs": 1064.2999999970198,"scriptSourceOwnerSet": "editor-workflow-static","stateProfile": "empty"},@@ -445,13 +445,13 @@"scriptRequestCount": 6,"totalRawBytes": 383447},- "domContentLoadedMedianMs": 120.89999999850988,+ "domContentLoadedMedianMs": 122.60000000149012,"id": "editor-workflow",- "layoutAckMedianMs": 3.6999999955296516,- "layoutReturnSwitchMedianMs": 43.19999999552965,- "layoutSwitchMedianMs": 129.5,- "loadMedianMs": 121,- "longestTaskMaxMs": 381,+ "layoutAckMedianMs": 2.7000000029802322,+ "layoutReturnSwitchMedianMs": 45.20000000298023,+ "layoutSwitchMedianMs": 135.39999999850988,+ "loadMedianMs": 122.70000000298023,+ "longestTaskMaxMs": 389,"owner": "workflow","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:workflow",@@ -461,24 +461,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158414,+ "otherRawBytes": 158619,"requestCount": 122,- "scriptRawBytes": 3630058,+ "scriptRawBytes": 3631552,"scriptRequestCount": 116,- "totalRawBytes": 3986084+ "totalRawBytes": 3987783},"resourceLimits": {"cssRawBytes": 17748,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 159999,+ "otherRawBytes": 160206,"requestCount": 122,- "scriptRawBytes": 3666359,+ "scriptRawBytes": 3667868,"scriptRequestCount": 116,- "totalRawBytes": 4025945+ "totalRawBytes": 4027661},- "routeReadyMedianMs": 1226.2999999970198,+ "routeReadyMedianMs": 1258.8999999985099,"scriptSourceOwnerSet": "editor-workflow-static","stateProfile": "representative"},@@ -505,13 +505,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 123.39999999850988,+ "domContentLoadedMedianMs": 123.30000000447035,"id": "editor-gallery","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,- "layoutSwitchMedianMs": 27.5,+ "layoutSwitchMedianMs": 29.5,"loadMedianMs": 123.5,- "longestTaskMaxMs": 106,+ "longestTaskMaxMs": 103,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -521,24 +521,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158414,+ "otherRawBytes": 158619,"requestCount": 115,- "scriptRawBytes": 3265821,+ "scriptRawBytes": 3267315,"scriptRequestCount": 110,- "totalRawBytes": 3606434+ "totalRawBytes": 3608133},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 159999,+ "otherRawBytes": 160206,"requestCount": 115,- "scriptRawBytes": 3298480,+ "scriptRawBytes": 3299989,"scriptRequestCount": 110,- "totalRawBytes": 3642499+ "totalRawBytes": 3644215},- "routeReadyMedianMs": 1298.7999999970198,+ "routeReadyMedianMs": 1290,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "empty"},@@ -565,13 +565,13 @@"scriptRequestCount": 0,"totalRawBytes": 0},- "domContentLoadedMedianMs": 125.5,+ "domContentLoadedMedianMs": 122.39999999850988,"id": "editor-gallery","layoutAckMedianMs": 0,"layoutReturnSwitchMedianMs": 0,- "layoutSwitchMedianMs": 96.79999999701977,- "loadMedianMs": 125.60000000149012,- "longestTaskMaxMs": 197,+ "layoutSwitchMedianMs": 96.5,+ "loadMedianMs": 122.5,+ "longestTaskMaxMs": 194,"owner": "gallery","projectSwitchMedianMs": 0,"readyMark": "invokeai:ready:widget:center:gallery",@@ -581,24 +581,24 @@"fontRawBytes": 23664,"imageRawBytes": 156376,"largestAssetRawBytes": 746376,- "otherRawBytes": 158414,+ "otherRawBytes": 158619,"requestCount": 115,- "scriptRawBytes": 3265821,+ "scriptRawBytes": 3267315,"scriptRequestCount": 110,- "totalRawBytes": 3606434+ "totalRawBytes": 3608133},"resourceLimits": {"cssRawBytes": 2181,"fontRawBytes": 23901,"imageRawBytes": 157940,"largestAssetRawBytes": 753840,- "otherRawBytes": 159999,+ "otherRawBytes": 160206,"requestCount": 115,- "scriptRawBytes": 3298480,+ "scriptRawBytes": 3299989,"scriptRequestCount": 110,- "totalRawBytes": 3642499+ "totalRawBytes": 3644215},- "routeReadyMedianMs": 1506.3999999985099,+ "routeReadyMedianMs": 1518.3000000044703,"scriptSourceOwnerSet": "editor-minimal-static","stateProfile": "representative"}@@ -2848,7 +2848,7 @@"source:src/workbench/widgets/generate/manifest.ts","source:src/workbench/widgets/image-map/ImageMapDataRuntime.tsx","source:src/workbench/widgets/image-map/manifest.ts",- "source:src/workbench/widgets/layers/AdjustmentsPopover.tsx",+ "source:src/workbench/widgets/layers/AdjustmentSettings.tsx","source:src/workbench/widgets/layers/ControlLayerSettings.tsx","source:src/workbench/widgets/layers/ControlLayerWarningIcon.tsx","source:src/workbench/widgets/layers/InpaintMaskSettings.tsx",diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex ba4a8e958e..729e88fee5 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -2506,7 +2506,6 @@"addRegionalGuidance": "Regional guidance","addRegionalReferenceImage": "Regional reference image","actionFailed": "Layer action failed",- "adjustments": "Adjustments","blendMode": "Blend mode","busy": "The canvas is busy. Try again when the current action finishes.","copyFailed": "The layer could not be copied.",@@ -2838,9 +2837,7 @@"contrast": "Contrast","curves": "Curves","curvesHint": "Drag points to bend the curve. Double-click empty space to add a point; double-click a point to remove it.",- "reset": "Reset adjustments","saturation": "Saturation",- "title": "Adjustments","transparencyLock": "Lock transparency"},"blendModes": {@@ -2913,7 +2910,8 @@"arrange": "Arrange","booleanOperations": "Boolean operations","convertTo": "Convert to",- "copyTo": "Copy to"+ "copyTo": "Copy to",+ "addAdjustment": "Add adjustment"},"options": "Layer options","regionalGuidance": {@@ -3030,7 +3028,13 @@"noise": "Noise","noiseHelp": "Adds noise inside the masked area before generation.","removeDenoise": "Remove denoise limit",- "removeNoise": "Remove noise"+ "removeNoise": "Remove noise",+ "brightnessContrast": "Brightness/Contrast",+ "duplicateAdjustment": "Duplicate adjustment",+ "moveDown": "Move down",+ "moveUp": "Move up",+ "removeAdjustment": "Remove adjustment",+ "reorderAdjustment": "Reorder adjustment"}},"gallery": {diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/capabilities.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/capabilities.tsindex f0fd133e17..60151d9b1d 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/capabilities.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/capabilities.ts@@ -610,7 +610,7 @@ export {export type { LayerTransform } from './transform/transformMath';export type { ImageResolver } from './render/rasterizers';export type { Rect, SelectionOp, ToolId, Vec2 } from './types';-export { adjustmentsKey, buildCurveLut, DEFAULT_ADJUSTMENTS } from './render/adjustments';+export { adjustmentsKey, buildCurveLut } from './render/adjustments';export { DEFAULT_CHECKER_COLORS } from './render/compositor';export {getBaseRasterContentBounds,diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/contracts.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/contracts.tsindex b42386e213..0074068edd 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/contracts.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/contracts.ts@@ -161,13 +161,25 @@ export interface CanvasLayerBaseContract {transform: { x: number; y: number; scaleX: number; scaleY: number; rotation: number };}-export interface CanvasAdjustmentsContract {- brightness: number;- contrast: number;- saturation: number;- curves?: { r: [number, number][]; g: [number, number][]; b: [number, number][] };+export interface CanvasAdjustmentCurves {+ r?: [number, number][];+ g?: [number, number][];+ b?: [number, number][];}+/**+ * One non-destructive adjustment in a raster layer's ordered stack. List order+ * is application order; disabling keeps the tuned values out of every render+ * without losing them. The Layers tree projects each entry as a child row.+ */+export type CanvasAdjustmentEntry =+ | { id: string; isEnabled: boolean; type: 'brightness-contrast'; brightness: number; contrast: number }+ | { id: string; isEnabled: boolean; type: 'hsl'; saturation: number }+ | { id: string; isEnabled: boolean; type: 'curves'; curves: CanvasAdjustmentCurves };++/** A raster layer's ordered adjustment stack, applied top to bottom. */+export type CanvasAdjustmentsContract = readonly CanvasAdjustmentEntry[];+export interface CanvasControlAdapterContract {kind: 'controlnet' | 't2i_adapter' | 'control_lora' | 'z_image_control';model: string | null;diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.tsindex 67d8973b80..c2542c7899 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/psdExportController.ts@@ -16,6 +16,7 @@ import {type PsdExportPlan,} from '@workbench/canvas-engine/export/psdExport';import { isExportableRasterLayer } from '@workbench/canvas-engine/layerExportGuards';+import { isIdentityAdjustments } from '@workbench/canvas-engine/render/adjustments';type RasterMemoryReservationResult =| { status: 'ok'; lease: { release(): void } }@@ -117,7 +118,9 @@ export class PsdExportController {}return [{- adjustments: node.type === 'raster' ? node.adjustments : undefined,+ // Identity-aware: an emptied stack must not trigger the executor's bake writeback.+ adjustments:+ node.type === 'raster' && !isIdentityAdjustments(node.adjustments) ? node.adjustments : undefined,blendMode: node.blendMode,contentRect: detached.rect,id: node.id,diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterController.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterController.test.tsindex 447f9b81ad..bac346b90b 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterController.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterController.test.ts@@ -17,10 +17,12 @@ describe('RasterController', () => {});const entry = controller.layers.getOrCreate('a', 10, 10);const layer = {- adjustments: { brightness: 0.5, contrast: 0, saturation: 0 },+ adjustments: [+ { brightness: 0.5, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],id: 'a',type: 'raster',- } as CanvasRasterLayerContractV2;+ } as unknown as CanvasRasterLayerContractV2;expect(controller.getAdjustedSurface(layer, entry)).not.toBeNull();expect(controller.derived.byteSize()).toBe(400);diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.test.tsindex 11e808b2fc..acdb32fd8e 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.test.ts@@ -66,7 +66,9 @@ describe('RasterExportController budget', () => {entry.hasPublishedPixels = true;entry.stale = false;const layer = {- adjustments: { brightness: 0.1, contrast: 0, saturation: 0 },+ adjustments: [+ { brightness: 0.1, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],blendMode: 'normal' as const,id: 'layer',isEnabled: true,@@ -116,7 +118,9 @@ describe('RasterExportController budget', () => {entry.hasPublishedPixels = true;entry.stale = false;const layer = {- adjustments: { brightness: 0.1, contrast: 0, saturation: 0 },+ adjustments: [+ { brightness: 0.1, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],blendMode: 'normal' as const,id: 'layer',isEnabled: true,diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.tsindex f405fe47c7..3b18efdeeb 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/controllers/rasterExportController.ts@@ -17,7 +17,7 @@ import { lookupDocumentLayer, lookupDocumentLeaf } from '@workbench/canvas-enginimport { getSourceContentRect, renderableSourceOf } from '@workbench/canvas-engine/document/sources';import { fromTRS } from '@workbench/canvas-engine/math/mat2d';import { isEmpty, roundOut, transformBounds } from '@workbench/canvas-engine/math/rect';-import { applyAdjustments } from '@workbench/canvas-engine/render/adjustments';+import { applyAdjustments, isIdentityAdjustments } from '@workbench/canvas-engine/render/adjustments';export type ExportLayerPixelsResult =| {@@ -69,7 +69,8 @@ export class RasterExportController {shouldApply: boolean): ExportLayerPixelsResult {const layer = result.guard.layer;- if (!shouldApply || layer.type !== 'raster' || !layer.adjustments) {+ // Identity-aware: an emptied or all-disabled stack must not reserve or copy.+ if (!shouldApply || layer.type !== 'raster' || isIdentityAdjustments(layer.adjustments)) {return result;}const reservation = this.options.reserve?.(result.rect.width * result.rect.height * 8);@@ -206,7 +207,8 @@ export class RasterExportController {raw.release();return noReservedPixels({ status: 'empty' });}- const appliesAdjustments = options.applyAdjustments !== false && layer.type === 'raster' && !!layer.adjustments;+ const appliesAdjustments =+ options.applyAdjustments !== false && layer.type === 'raster' && !isIdentityAdjustments(layer.adjustments);const reservation = this.options.reserve?.(rect.width * rect.height * (appliesAdjustments ? 8 : 4));if (reservation?.status === 'over-budget') {raw.release();diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/editing/controlPixelEdit.browser.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/editing/controlPixelEdit.browser.test.tsindex 7c5d4116ab..3c77672337 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/editing/controlPixelEdit.browser.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/editing/controlPixelEdit.browser.test.ts@@ -19,7 +19,7 @@ import { bakePixelEditSurface } from './controlPixelEdit';const IDENTITY = { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 } as const;const imageLayer = (overrides: Partial<CanvasRasterLayerContractV2> = {}): CanvasRasterLayerContractV2 => ({- adjustments: { brightness: 0.5, contrast: 0, saturation: 0 },+ adjustments: [{ brightness: 0.5, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const }],blendMode: 'normal',id: 'image',isEnabled: true,diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/editing/controlPixelEdit.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/editing/controlPixelEdit.test.tsindex 12ea95a4f1..46550bf140 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/editing/controlPixelEdit.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/editing/controlPixelEdit.test.ts@@ -180,7 +180,10 @@ describe('buildMaterializedPixelLayer', () => {it('clears raster adjustments after baking them into a paint source', () => {const before: CanvasLayerContract = {- adjustments: { brightness: 0.2, contrast: -0.1, saturation: 0.3 },+ adjustments: [+ { brightness: 0.2, contrast: -0.1, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ { id: 'adj-hsl', isEnabled: true, saturation: 0.3, type: 'hsl' as const },+ ],blendMode: 'normal',id: 'image',isEnabled: true,diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/engine.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/engine.test.tsindex d245fdfc9c..14ac04f0ed 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/engine.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/engine.test.ts@@ -1199,7 +1199,9 @@ describe('createCanvasEngine', () => {it('exportLayerPixels can bake raster adjustments in layer-local space without baking presentation props', async () => {const layer: CanvasRasterLayerContractV2 = {...(rasterLayer('a') as CanvasRasterLayerContractV2),- adjustments: { brightness: 0.25, contrast: 0, saturation: 0 },+ adjustments: [+ { brightness: 0.25, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],blendMode: 'multiply',opacity: 0.4,source: {@@ -1498,7 +1500,9 @@ describe('createCanvasEngine', () => {it('exportBakedLayerPixels bakes raster adjustments into the exported surface only', async () => {const layer = {...rasterLayer('a'),- adjustments: { brightness: 0.25, contrast: 0, saturation: 0 },+ adjustments: [+ { brightness: 0.25, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],};const { store } = createFakeStore({ ...makeDoc(), stacks: stacksFrom([layer]) });const engine = createCanvasEngine({@@ -1529,7 +1533,9 @@ describe('createCanvasEngine', () => {it('exportBakedLayerPixels applies adjustments exactly once when explicitly requested', async () => {const layer = {...rasterLayer('a'),- adjustments: { brightness: 0.25, contrast: 0, saturation: 0 },+ adjustments: [+ { brightness: 0.25, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],};const { store } = createFakeStore({ ...makeDoc(), stacks: stacksFrom([layer]) });const base = createTestStubRasterBackend();@@ -1834,7 +1840,10 @@ describe('createCanvasEngine', () => {it('cropLayerToBbox crops only the bbox overlap and restores exact contracts/cache snapshots on undo/redo', async () => {const layer = {...rasterLayer('a'),- adjustments: { brightness: 0.2, contrast: -0.1, saturation: 0.3 },+ adjustments: [+ { brightness: 0.2, contrast: -0.1, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ { id: 'adj-hsl', isEnabled: true, saturation: 0.3, type: 'hsl' as const },+ ],transform: { rotation: 0, scaleX: 1, scaleY: 1, x: 5, y: 5 },};const document = { ...makeDoc(), bbox: { height: 8, width: 10, x: 8, y: 2 }, stacks: stacksFrom([layer]) };@@ -2903,7 +2912,10 @@ const createRasterImageEraserHarness = (options: ControlPaintHarnessOptions = {}) => {const layer: CanvasRasterLayerContractV2 = {- adjustments: { brightness: 0.1, contrast: 0.2, saturation: -0.1 },+ adjustments: [+ { brightness: 0.1, contrast: 0.2, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ { id: 'adj-hsl', isEnabled: true, saturation: -0.1, type: 'hsl' as const },+ ],blendMode: 'screen',id: 'image',isEnabled: true,@@ -4305,7 +4317,10 @@ const largeThumbnailLayer = (if (kind === 'raster') {return {...rasterLayer('a'),- adjustments: { brightness: 0.25, contrast: -0.1, saturation: 0.3 },+ adjustments: [+ { brightness: 0.25, contrast: -0.1, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ { id: 'adj-hsl', isEnabled: true, saturation: 0.3, type: 'hsl' as const },+ ],source: { bitmap: image, offset: { x: -300, y: 250 }, type: 'paint' },} as CanvasRasterLayerContractV2;}@@ -4419,7 +4434,10 @@ describe('drawLayerThumbnail', () => {it('draws adjusted raster pixels over the checkerboard', async () => {const layer = {...rasterLayer('a'),- adjustments: { brightness: 0.2, contrast: -0.1, saturation: 0.3 },+ adjustments: [+ { brightness: 0.2, contrast: -0.1, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ { id: 'adj-hsl', isEnabled: true, saturation: 0.3, type: 'hsl' as const },+ ],opacity: 0.4,} as CanvasRasterLayerContractV2;const backend = createSeededThumbnailBackend([10, 20, 30, 255]);@@ -4554,7 +4572,9 @@ describe('drawLayerThumbnail', () => {rasterLayer('a'),(layer: CanvasLayerContract) => ({...layer,- adjustments: { brightness: 0.25, contrast: 0, saturation: 0 },+ adjustments: [+ { brightness: 0.25, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],}),],[@@ -4618,7 +4638,9 @@ describe('drawLayerThumbnail', () => {const adjusted = {...layer,- adjustments: { brightness: 0.25, contrast: 0, saturation: 0 },+ adjustments: [+ { brightness: 0.25, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],} as CanvasLayerContract;setDocument({ ...doc, stacks: stacksFrom([adjusted]) });setDocument({ ...doc, stacks: stacksFrom([rasterLayer('a', { imageName: 'a-v2' })]) });@@ -8757,7 +8779,10 @@ describe('commitRasterFilterResult', () => {};const filterLayer = (id = 'L'): CanvasRasterLayerContractV2 => ({- adjustments: { brightness: 0.2, contrast: -0.1, saturation: 0.3 },+ adjustments: [+ { brightness: 0.2, contrast: -0.1, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ { id: 'adj-hsl', isEnabled: true, saturation: 0.3, type: 'hsl' as const },+ ],blendMode: 'multiply',id,isEnabled: true,@@ -10325,7 +10350,10 @@ describe('commitGeneratedImageResult', () => {const generatedOrigin = { x: -9, y: 14 };const workflowRaster = (id = 'source'): CanvasRasterLayerContractV2 => ({- adjustments: { brightness: 0.2, contrast: -0.1, saturation: 0.3 },+ adjustments: [+ { brightness: 0.2, contrast: -0.1, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ { id: 'adj-hsl', isEnabled: true, saturation: 0.3, type: 'hsl' as const },+ ],blendMode: 'multiply',id,isEnabled: true,@@ -13184,7 +13212,14 @@ describe('guarded filter previews', () => {await flushMicrotasks();setDocument({...document,- stacks: stacksFrom([{ ...layer, adjustments: { brightness: 0.2, contrast: 0, saturation: 0 } }]),+ stacks: stacksFrom([+ {+ ...layer,+ adjustments: [+ { brightness: 0.2, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],+ },+ ]),});bitmaps.resolveBitmap(0);@@ -13435,7 +13470,14 @@ describe('guarded filter previews', () => {const harness = await createPublishedGuardedPreview();harness.setDocument({...harness.document,- stacks: stacksFrom([{ ...harness.layer, adjustments: { brightness: 0.3, contrast: 0, saturation: 0 } }]),+ stacks: stacksFrom([+ {+ ...harness.layer,+ adjustments: [+ { brightness: 0.3, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],+ },+ ]),});harness.raf.flush();@@ -17994,7 +18036,10 @@ describe('Select Object canvas engine integration', () => {// baked world rect {4, 17, 20, 15}.const raster: CanvasLayerContract = {...samLayer('adjusted-raster'),- adjustments: { brightness: 0.2, contrast: -0.1, saturation: 0.3 },+ adjustments: [+ { brightness: 0.2, contrast: -0.1, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ { id: 'adj-hsl', isEnabled: true, saturation: 0.3, type: 'hsl' as const },+ ],blendMode: 'multiply',opacity: 0.4,source: {diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.test.tsindex 80cc0d4d3c..33f872f564 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/export/psdExport.test.ts@@ -143,7 +143,9 @@ describe('planPsdExport', () => {});it('passes non-destructive adjustments through for the executor to bake', () => {- const adjustments = { brightness: 0.2, contrast: 0, saturation: 0 };+ const adjustments = [+ { brightness: 0.2, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ];const plan = planPsdExport([layer({ adjustments })]);expect(findLayer(plan, 'a').adjustments).toBe(adjustments);});diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/exportRasterComposite.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/exportRasterComposite.test.tsindex 87e1dc597d..c993222558 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/exportRasterComposite.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/exportRasterComposite.test.ts@@ -174,7 +174,16 @@ describe('exportRasterComposite', () => {if (layer.type !== 'raster') {throw new Error('Expected raster layer');}- const { deps } = makeDeps(makeDoc([{ ...layer, adjustments: { brightness: 0.1, contrast: 0, saturation: 0 } }]));+ const { deps } = makeDeps(+ makeDoc([+ {+ ...layer,+ adjustments: [+ { brightness: 0.1, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],+ },+ ])+ );const reserve = vi.fn(() => ({ lease: { release: vi.fn() }, status: 'ok' as const }));deps.reserve = reserve;diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustedSurfaceCache.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustedSurfaceCache.test.tsindex 0de8f051e6..dbdccc50e3 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustedSurfaceCache.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustedSurfaceCache.test.ts@@ -8,8 +8,12 @@ import type { StubRasterSurface } from './raster.testStub';import { createAdjustedSurfaceCache } from './adjustedSurfaceCache';import { createTestStubRasterBackend } from './raster.testStub';-const BRIGHTEN: CanvasAdjustmentsContract = { brightness: 0.5, contrast: 0, saturation: 0 };-const CONTRAST: CanvasAdjustmentsContract = { brightness: 0, contrast: 0.5, saturation: 0 };+const BRIGHTEN: CanvasAdjustmentsContract = [+ { brightness: 0.5, contrast: 0, id: 'b', isEnabled: true, type: 'brightness-contrast' },+];+const CONTRAST: CanvasAdjustmentsContract = [+ { brightness: 0, contrast: 0.5, id: 'c', isEnabled: true, type: 'brightness-contrast' },+];const makeEntry = (layerId: string, surface: StubRasterSurface, version = 0): LayerCacheEntry => ({hasPublishedPixels: true,@@ -30,7 +34,9 @@ describe('createAdjustedSurfaceCache', () => {const cache = createAdjustedSurfaceCache(backend);const entry = makeEntry('a', backend.createSurface(10, 10));expect(cache.get('a', entry, undefined)).toBeNull();- expect(cache.get('a', entry, { brightness: 0, contrast: 0, saturation: 0 })).toBeNull();+ expect(+ cache.get('a', entry, [{ brightness: 0, contrast: 0, id: 'i', isEnabled: true, type: 'brightness-contrast' }])+ ).toBeNull();expect(cache.size()).toBe(0);});diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustedSurfaceDamage.browser.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustedSurfaceDamage.browser.test.tsindex 462574a836..9a79eb0d29 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustedSurfaceDamage.browser.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustedSurfaceDamage.browser.test.ts@@ -22,12 +22,10 @@ import { describe, expect, it } from 'vitest';const WIDTH = 320;const HEIGHT = 240;-const ADJUSTMENTS = {- brightness: 0.25,- contrast: 0.15,- hue: 0,- saturation: -0.2,-} as unknown as CanvasAdjustmentsContract;+const ADJUSTMENTS: CanvasAdjustmentsContract = [+ { brightness: 0.25, contrast: 0.15, id: 'bc', isEnabled: true, type: 'brightness-contrast' },+ { id: 'sat', isEnabled: true, saturation: -0.2, type: 'hsl' },+];/** A layer cache seeded with a gradient, plus an adjusted cache over it. */const setup = (withDamageTracking: boolean) => {diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.test.tsindex 41d191941f..cd81635235 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.test.ts@@ -1,13 +1,13 @@-import type { CanvasAdjustmentsContract } from '@workbench/canvas-engine/contracts';+import type { CanvasAdjustmentCurves, CanvasAdjustmentEntry } from '@workbench/canvas-engine/contracts';import { describe, expect, it } from 'vitest';import {adjustmentsKey,applyAdjustments,- buildAdjustmentLuts,buildCurveLut,- DEFAULT_ADJUSTMENTS,+ compileAdjustments,+ isIdentityAdjustmentEntry,isIdentityAdjustments,} from './adjustments';@@ -15,6 +15,14 @@ import {const imageData = (pixels: number[]): ImageData =>({ data: new Uint8ClampedArray(pixels), height: 1, width: pixels.length / 4 }) as ImageData;+type EntryOverrides = Partial<Pick<CanvasAdjustmentEntry, 'id' | 'isEnabled'>>;+const bc = (brightness: number, contrast: number, overrides: EntryOverrides = {}) =>+ ({ brightness, contrast, id: 'bc', isEnabled: true, type: 'brightness-contrast', ...overrides }) as const;+const hsl = (saturation: number, overrides: EntryOverrides = {}) =>+ ({ id: 'hsl', isEnabled: true, saturation, type: 'hsl', ...overrides }) as const;+const curves = (points: CanvasAdjustmentCurves) =>+ ({ curves: points, id: 'cv', isEnabled: true, type: 'curves' }) as const;+describe('buildCurveLut', () => {it('is the identity for absent / empty / diagonal curves', () => {for (const pts of [@@ -64,148 +72,130 @@ describe('buildCurveLut', () => {});});-describe('buildAdjustmentLuts', () => {- it('is the identity for default adjustments', () => {- const { b, g, r } = buildAdjustmentLuts(DEFAULT_ADJUSTMENTS);- for (let i = 0; i < 256; i++) {- expect(r[i]).toBe(i);- expect(g[i]).toBe(i);- expect(b[i]).toBe(i);- }- });-- it('applies additive brightness and clamps', () => {- const { r } = buildAdjustmentLuts({ brightness: 0.5, contrast: 0, saturation: 0 });- // +0.5*255 ≈ +128 (rounded).- expect(r[0]).toBe(128);- expect(r[200]).toBe(255); // clamped- });-- it('applies contrast about mid-grey', () => {- const { r } = buildAdjustmentLuts({ brightness: 0, contrast: 1, saturation: 0 });- // factor 2 about 128: 128 stays, 0 → -128 clamp 0, 255 → 382 clamp 255.- expect(r[128]).toBe(128);- expect(r[0]).toBe(0);- expect(r[255]).toBe(255);- expect(r[64]).toBe(0); // (64-128)*2+128 = 0- expect(r[192]).toBe(255); // (192-128)*2+128 = 256 → clamp- });-- it('composes curve → brightness → contrast', () => {- // A curve mapping everything to 100, then +0 brightness, contrast 0 → all 100.- const { r } = buildAdjustmentLuts({- brightness: 0,- contrast: 0,- curves: {- b: [- [0, 0],- [255, 255],- ],- g: [- [0, 0],- [255, 255],- ],- r: [- [0, 100],- [255, 100],- ],- },- saturation: 0,- });- expect(r[0]).toBe(100);- expect(r[255]).toBe(100);- });-});--describe('isIdentityAdjustments / adjustmentsKey', () => {- it('treats zeros + diagonal / absent curves as identity', () => {+describe('identity and keys', () => {+ it('treats zero values, diagonal/absent curves, disabled entries and empty stacks as identity', () => {expect(isIdentityAdjustments(undefined)).toBe(true);- expect(isIdentityAdjustments(DEFAULT_ADJUSTMENTS)).toBe(true);+ expect(isIdentityAdjustments([])).toBe(true);+ expect(isIdentityAdjustments([bc(0, 0), hsl(0), curves({})])).toBe(true);expect(- isIdentityAdjustments({- brightness: 0,- contrast: 0,- saturation: 0,- curves: {- b: [- [0, 0],- [255, 255],- ],- g: [- [0, 0],- [255, 255],- ],+ isIdentityAdjustments([+ curves({r: [[0, 0],[255, 255],],- },- })+ }),+ ])).toBe(true);- expect(adjustmentsKey(DEFAULT_ADJUSTMENTS)).toBe('identity');- });-- it('is non-identity for any non-zero param or bent curve', () => {- expect(isIdentityAdjustments({ brightness: 0.1, contrast: 0, saturation: 0 })).toBe(false);+ expect(isIdentityAdjustments([bc(0.5, 0, { isEnabled: false })])).toBe(true);+ expect(isIdentityAdjustments([bc(0.5, 0)])).toBe(false);expect(- isIdentityAdjustments({- brightness: 0,- contrast: 0,- saturation: 0,- curves: {- b: [- [0, 0],- [255, 255],- ],- g: [- [0, 0],- [255, 255],- ],+ isIdentityAdjustmentEntry(+ curves({r: [[0, 0],[128, 200],[255, 255],],- },- })+ })+ )).toBe(false);});- it('produces distinct, stable keys per distinct adjustment', () => {- const a: CanvasAdjustmentsContract = { brightness: 0.2, contrast: 0, saturation: 0 };- const b: CanvasAdjustmentsContract = { brightness: 0.3, contrast: 0, saturation: 0 };- expect(adjustmentsKey(a)).toBe(adjustmentsKey({ ...a }));- expect(adjustmentsKey(a)).not.toBe(adjustmentsKey(b));+ it('keys identify the pixel effect: stable across entry ids, sensitive to order and values', () => {+ expect(adjustmentsKey([bc(0, 0), hsl(0)])).toBe('identity');+ expect(adjustmentsKey([bc(0.2, 0)])).toBe(adjustmentsKey([bc(0.2, 0, { id: 'other' })]));+ expect(adjustmentsKey([bc(0.2, 0)])).not.toBe(adjustmentsKey([bc(0.3, 0)]));+ expect(adjustmentsKey([bc(0.2, 0), hsl(0.5)])).not.toBe(adjustmentsKey([hsl(0.5), bc(0.2, 0)]));+ // A disabled entry keys exactly like an absent one.+ expect(adjustmentsKey([bc(0.2, 0), hsl(0.5, { isEnabled: false })])).toBe(adjustmentsKey([bc(0.2, 0)]));});});-describe('applyAdjustments', () => {- it('is a no-op for identity adjustments', () => {- const img = imageData([10, 20, 30, 255]);- applyAdjustments(img, DEFAULT_ADJUSTMENTS);- expect(Array.from(img.data)).toEqual([10, 20, 30, 255]);+describe('compileAdjustments', () => {+ it('folds adjacent per-channel entries into one LUT segment and keeps saturation apart', () => {+ const folded = compileAdjustments([+ curves({+ r: [+ [0, 0],+ [128, 200],+ [255, 255],+ ],+ }),+ bc(0.1, 0.2),+ ]);+ expect(folded.map((segment) => segment.kind)).toEqual(['lut']);++ const split = compileAdjustments([bc(0.1, 0), hsl(0.5), bc(0, 0.3)]);+ expect(split.map((segment) => segment.kind)).toEqual(['lut', 'saturation', 'lut']);+ });++ it('a folded pair produces the same pixels as sequential application', () => {+ const curve = curves({+ r: [+ [0, 0],+ [64, 160],+ [255, 255],+ ],+ });+ const sequential = imageData([10, 20, 30, 255, 200, 100, 50, 255]);+ applyAdjustments(sequential, [curve]);+ applyAdjustments(sequential, [bc(0.1, 0.4)]);+ const folded = imageData([10, 20, 30, 255, 200, 100, 50, 255]);+ applyAdjustments(folded, [curve, bc(0.1, 0.4)]);+ expect(Array.from(folded.data)).toEqual(Array.from(sequential.data));});+});- it('never modifies alpha', () => {+describe('applyAdjustments', () => {+ it('is a no-op for an identity stack and never modifies alpha', () => {const img = imageData([10, 20, 30, 128]);- applyAdjustments(img, { brightness: 0.5, contrast: 0, saturation: 0 });+ applyAdjustments(img, [bc(0, 0), hsl(0)]);+ expect(Array.from(img.data)).toEqual([10, 20, 30, 128]);+ applyAdjustments(img, [bc(0.5, 0)]);expect(img.data[3]).toBe(128);});- it('brightens rgb', () => {+ it('brightens rgb additively and clamps', () => {const img = imageData([10, 20, 30, 255]);- applyAdjustments(img, { brightness: 0.5, contrast: 0, saturation: 0 });+ applyAdjustments(img, [bc(0.5, 0)]);expect(img.data[0]).toBe(138); // 10 + 128expect(img.data[1]).toBe(148);expect(img.data[2]).toBe(158);+ const clamped = imageData([200, 0, 0, 255]);+ applyAdjustments(clamped, [bc(0.5, 0)]);+ expect(clamped.data[0]).toBe(255);+ });++ it('applies contrast about mid-grey', () => {+ const img = imageData([64, 128, 192, 255]);+ applyAdjustments(img, [bc(0, 1)]);+ expect(img.data[0]).toBe(0); // (64-128)*2+128+ expect(img.data[1]).toBe(128);+ expect(img.data[2]).toBe(255);});it('fully desaturates to luma at saturation -1', () => {const img = imageData([200, 100, 50, 255]);- applyAdjustments(img, { brightness: 0, contrast: 0, saturation: -1 });+ applyAdjustments(img, [hsl(-1)]);const luma = Math.round(0.299 * 200 + 0.587 * 100 + 0.114 * 50);expect(img.data[0]).toBe(luma);expect(img.data[1]).toBe(luma);expect(img.data[2]).toBe(luma);});++ it('entry order changes the pixels; a disabled entry renders exactly as a removed one', () => {+ const source = [180, 60, 40, 255];+ const bcFirst = imageData([...source]);+ applyAdjustments(bcFirst, [bc(0.3, 0.5), hsl(-0.8)]);+ const hslFirst = imageData([...source]);+ applyAdjustments(hslFirst, [hsl(-0.8), bc(0.3, 0.5)]);+ expect(Array.from(bcFirst.data)).not.toEqual(Array.from(hslFirst.data));++ const withDisabled = imageData([...source]);+ applyAdjustments(withDisabled, [bc(0.3, 0.5), hsl(-0.8, { isEnabled: false })]);+ const without = imageData([...source]);+ applyAdjustments(without, [bc(0.3, 0.5)]);+ expect(Array.from(withDisabled.data)).toEqual(Array.from(without.data));+ });});diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.tsindex e32145bb1c..795c2db4b0 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/adjustments.ts@@ -1,7 +1,4 @@-import type { CanvasAdjustmentsContract } from '@workbench/canvas-engine/contracts';--/** The identity adjustment (no brightness/contrast/saturation, no curves). */-export const DEFAULT_ADJUSTMENTS: CanvasAdjustmentsContract = { brightness: 0, contrast: 0, saturation: 0 };+import type { CanvasAdjustmentEntry, CanvasAdjustmentsContract } from '@workbench/canvas-engine/contracts';const LUT_SIZE = 256;@@ -121,92 +118,146 @@ export const buildCurveLut = (points: CurvePoints | undefined): Uint8ClampedArrareturn lut;};+/** True when `entry` cannot change a pixel, regardless of enablement. */+export const isIdentityAdjustmentEntry = (entry: CanvasAdjustmentEntry): boolean => {+ switch (entry.type) {+ case 'brightness-contrast':+ return entry.brightness === 0 && entry.contrast === 0;+ case 'hsl':+ return entry.saturation === 0;+ case 'curves':+ return isIdentityCurve(entry.curves.r) && isIdentityCurve(entry.curves.g) && isIdentityCurve(entry.curves.b);+ }+};++const contributes = (entry: CanvasAdjustmentEntry): boolean => entry.isEnabled && !isIdentityAdjustmentEntry(entry);++/** True when the stack is a no-op: empty, or only disabled/identity entries. */+export const isIdentityAdjustments = (adjustments: CanvasAdjustmentsContract | undefined): boolean =>+ !adjustments || adjustments.every((entry) => !contributes(entry));+/**- * Builds the composed per-channel LUTs for `adjustments`:- * `contrast(brightness(curve(i)))`, clamped to `[0, 255]`. Brightness/contrast are- * shared across channels; the curve is per-channel.+ * One step of the compiled pixel pass. Per-channel entries fold into LUT+ * segments (adjacent ones compose into ONE lut); a saturation entry is a+ * cross-channel luma lerp that cannot fold and stands alone.*/-export const buildAdjustmentLuts = (- adjustments: CanvasAdjustmentsContract-): { r: Uint8ClampedArray; g: Uint8ClampedArray; b: Uint8ClampedArray } => {- const brightnessOffset = (adjustments.brightness ?? 0) * 255;- const contrastFactor = 1 + (adjustments.contrast ?? 0);- const curves = adjustments.curves;-- const compose = (curveLut: Uint8ClampedArray): Uint8ClampedArray => {- const out = new Uint8ClampedArray(LUT_SIZE);- for (let i = 0; i < LUT_SIZE; i++) {- const curved = curveLut[i];- const brightened = curved + brightnessOffset;- const contrasted = (brightened - 128) * contrastFactor + 128;- out[i] = clamp255(Math.round(contrasted));+export type CompiledAdjustmentSegment =+ | {+ readonly kind: 'lut';+ readonly r: Uint8ClampedArray;+ readonly g: Uint8ClampedArray;+ readonly b: Uint8ClampedArray;}- return out;- };-- return {- b: compose(buildCurveLut(curves?.b)),- g: compose(buildCurveLut(curves?.g)),- r: compose(buildCurveLut(curves?.r)),- };+ | { readonly kind: 'saturation'; readonly factor: number };++const brightnessContrastLut = (brightness: number, contrast: number): Uint8ClampedArray => {+ const offset = brightness * 255;+ const factor = 1 + contrast;+ const lut = new Uint8ClampedArray(LUT_SIZE);+ for (let i = 0; i < LUT_SIZE; i++) {+ lut[i] = clamp255(Math.round((i + offset - 128) * factor + 128));+ }+ return lut;};-/** True when `adjustments` is a no-op (identity brightness/contrast/saturation + identity curves). */-export const isIdentityAdjustments = (adjustments: CanvasAdjustmentsContract | undefined): boolean => {- if (!adjustments) {- return true;+/** `outer` applied after `inner`, folded into one table. */+const composeLut = (inner: Uint8ClampedArray, outer: Uint8ClampedArray): Uint8ClampedArray => {+ const lut = new Uint8ClampedArray(LUT_SIZE);+ for (let i = 0; i < LUT_SIZE; i++) {+ lut[i] = outer[inner[i]];}- if ((adjustments.brightness ?? 0) !== 0 || (adjustments.contrast ?? 0) !== 0 || (adjustments.saturation ?? 0) !== 0) {- return false;+ return lut;+};++const entryLuts = (+ entry: Extract<CanvasAdjustmentEntry, { type: 'brightness-contrast' | 'curves' }>+): { r: Uint8ClampedArray; g: Uint8ClampedArray; b: Uint8ClampedArray } => {+ if (entry.type === 'brightness-contrast') {+ const lut = brightnessContrastLut(entry.brightness, entry.contrast);+ return { b: lut, g: lut, r: lut };}- const { curves } = adjustments;- if (!curves) {- return true;+ return { b: buildCurveLut(entry.curves.b), g: buildCurveLut(entry.curves.g), r: buildCurveLut(entry.curves.r) };+};++/**+ * Compiles the stack into the fewest segments that reproduce it in order:+ * enabled non-identity entries only, adjacent per-channel entries folded into+ * one LUT trio. The empty result means identity.+ */+export const compileAdjustments = (adjustments: CanvasAdjustmentsContract | undefined): CompiledAdjustmentSegment[] => {+ const segments: CompiledAdjustmentSegment[] = [];+ for (const entry of adjustments ?? []) {+ if (!contributes(entry)) {+ continue;+ }+ if (entry.type === 'hsl') {+ segments.push({ factor: 1 + entry.saturation, kind: 'saturation' });+ continue;+ }+ const luts = entryLuts(entry);+ const last = segments[segments.length - 1];+ if (last?.kind === 'lut') {+ segments[segments.length - 1] = {+ b: composeLut(last.b, luts.b),+ g: composeLut(last.g, luts.g),+ kind: 'lut',+ r: composeLut(last.r, luts.r),+ };+ } else {+ segments.push({ ...luts, kind: 'lut' });+ }}- return isIdentityCurve(curves.r) && isIdentityCurve(curves.g) && isIdentityCurve(curves.b);+ return segments;};-/** A deterministic cache key fully identifying an adjustment's pixel effect. */+/** A deterministic cache key fully identifying the stack's pixel effect; entry ids do not affect it. */export const adjustmentsKey = (adjustments: CanvasAdjustmentsContract | undefined): string => {- if (isIdentityAdjustments(adjustments)) {+ const active = (adjustments ?? []).filter(contributes);+ if (active.length === 0) {return 'identity';}- const a = adjustments as CanvasAdjustmentsContract;const curveKey = (pts: CurvePoints | undefined): string =>pts && pts.length > 0 ? pts.map(([x, y]) => `${x},${y}`).join(';') : '-';- return [- `b${a.brightness ?? 0}`,- `c${a.contrast ?? 0}`,- `s${a.saturation ?? 0}`,- `r:${curveKey(a.curves?.r)}`,- `g:${curveKey(a.curves?.g)}`,- `bl:${curveKey(a.curves?.b)}`,- ].join('|');+ return active+ .map((entry) => {+ switch (entry.type) {+ case 'brightness-contrast':+ return `bc:${entry.brightness},${entry.contrast}`;+ case 'hsl':+ return `s:${entry.saturation}`;+ case 'curves':+ return `cv:${curveKey(entry.curves.r)}|${curveKey(entry.curves.g)}|${curveKey(entry.curves.b)}`;+ }+ })+ .join('||');};/**- * Applies `adjustments` to `imageData` IN PLACE: the composed per-channel LUTs- * remap R/G/B, then saturation lerps each channel toward its luma. Alpha is never- * modified. A no-op for identity adjustments.+ * Applies the stack to `imageData` IN PLACE in one pixel pass: the compiled+ * segments run in order per pixel — LUT remaps, saturation luma lerps. Alpha+ * is never modified. A no-op for an identity stack.*/export const applyAdjustments = (imageData: ImageData, adjustments: CanvasAdjustmentsContract | undefined): void => {- if (isIdentityAdjustments(adjustments)) {+ const segments = compileAdjustments(adjustments);+ if (segments.length === 0) {return;}- const a = adjustments as CanvasAdjustmentsContract;- const { b: lutB, g: lutG, r: lutR } = buildAdjustmentLuts(a);- const sat = 1 + (a.saturation ?? 0);- const applySaturation = sat !== 1;const { data } = imageData;for (let i = 0; i + 3 < data.length; i += 4) {- let r = lutR[data[i]];- let g = lutG[data[i + 1]];- let b = lutB[data[i + 2]];- if (applySaturation) {- const lum = LUMA_R * r + LUMA_G * g + LUMA_B * b;- r = clamp255(Math.round(lum + (r - lum) * sat));- g = clamp255(Math.round(lum + (g - lum) * sat));- b = clamp255(Math.round(lum + (b - lum) * sat));+ let r = data[i];+ let g = data[i + 1];+ let b = data[i + 2];+ for (const segment of segments) {+ if (segment.kind === 'lut') {+ r = segment.r[r];+ g = segment.g[g];+ b = segment.b[b];+ } else {+ const lum = LUMA_R * r + LUMA_G * g + LUMA_B * b;+ r = clamp255(Math.round(lum + (r - lum) * segment.factor));+ g = clamp255(Math.round(lum + (g - lum) * segment.factor));+ b = clamp255(Math.round(lum + (b - lum) * segment.factor));+ }}data[i] = r;data[i + 1] = g;diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.test.tsindex db889a6cc7..3da1f7ad48 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/compositor.test.ts@@ -575,7 +575,11 @@ describe('compositeDocument — raster adjustments', () => {it('draws the provided adjusted surface instead of the raw cache for a raster layer', () => {const backend = createTestStubRasterBackend();const caches = createLayerCacheStore(backend);- const layer = rasterLayer('a', { adjustments: { brightness: 0.5, contrast: 0, saturation: 0 } });+ const layer = rasterLayer('a', {+ adjustments: [+ { brightness: 0.5, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],+ });const cache = caches.getOrCreate('a', 10, 10);const adjusted = backend.createSurface(10, 10);const target = backend.createSurface(200, 200);diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerDisplayEffect.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerDisplayEffect.test.tsindex b24221e132..677b53145a 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerDisplayEffect.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/layerDisplayEffect.test.ts@@ -57,11 +57,19 @@ describe('hasLayerDisplayEffect', () => {});it('is true for a raster layer with non-identity adjustments', () => {- expect(hasLayerDisplayEffect(rasterLayer({ brightness: 0.4, contrast: 0, saturation: 0 }))).toBe(true);+ expect(+ hasLayerDisplayEffect(+ rasterLayer([{ brightness: 0.4, contrast: 0, id: 'b', isEnabled: true, type: 'brightness-contrast' }])+ )+ ).toBe(true);});it('is false for a raster layer with identity or absent adjustments', () => {- expect(hasLayerDisplayEffect(rasterLayer({ brightness: 0, contrast: 0, saturation: 0 }))).toBe(false);+ expect(+ hasLayerDisplayEffect(+ rasterLayer([{ brightness: 0, contrast: 0, id: 'i', isEnabled: true, type: 'brightness-contrast' }])+ )+ ).toBe(false);expect(hasLayerDisplayEffect(rasterLayer(undefined))).toBe(false);});@@ -102,7 +110,7 @@ describe('renderLayerDisplayEffect', () => {it('returns a copy for a raster layer with adjustments', () => {const out = renderLayerDisplayEffect(backend,- rasterLayer({ brightness: 0.4, contrast: 0, saturation: 0 }),+ rasterLayer([{ brightness: 0.4, contrast: 0, id: 'b', isEnabled: true, type: 'brightness-contrast' }]),backend.createSurface(4, 4));expect(out).not.toBeNull();diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/thumbnail.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/thumbnail.test.tsindex 38096e9b74..fd72e99f25 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/thumbnail.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/thumbnail.test.ts@@ -12,7 +12,7 @@ import {const rasterLayer = (source: CanvasLayerSourceContract): CanvasLayerContract =>({- adjustments: { brightness: 0, contrast: 0, saturation: 0 },+ adjustments: [{ brightness: 0, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const }],blendMode: 'normal',id: 'raster',isEnabled: true,@@ -162,7 +162,9 @@ describe('getLayerThumbnailDisplayKey', () => {expect(getLayerThumbnailDisplayKey({...raster,- adjustments: { brightness: 0.2, contrast: 0, saturation: 0 },+ adjustments: [+ { brightness: 0.2, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],} as CanvasLayerContract)).not.toBe(getLayerThumbnailDisplayKey(raster));expect(getLayerThumbnailDisplayKey({ ...control, withTransparencyEffect: false } as CanvasLayerContract)).not.toBe(diff --git a/invokeai/frontend/webv2/src/workbench/canvas-operations/compositeForGeneration.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-operations/compositeForGeneration.test.tsindex 177bbef79d..ce6d98ae67 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-operations/compositeForGeneration.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-operations/compositeForGeneration.test.ts@@ -432,7 +432,13 @@ describe('executeCompositePlan — raster adjustments baked into generation pixe// Adjusted layer: brightness bake → the executor reads the temp, applies the// LUT, and writes the adjusted pixels back before compositing.- const adjustedDoc = makeDoc([rasterLayer('b', { adjustments: { brightness: 0.5, contrast: 0, saturation: 0 } })]);+ const adjustedDoc = makeDoc([+ rasterLayer('b', {+ adjustments: [+ { brightness: 0.5, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],+ }),+ ]);await executeCompositePlan(planComposites(adjustedDoc, BBOX), harness.deps);expect(writeImageData).toHaveBeenCalledTimes(1);});diff --git a/invokeai/frontend/webv2/src/workbench/canvas-operations/generationCompositePlan.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-operations/generationCompositePlan.test.tsindex 6ad504b040..43ae2ceb36 100644--- a/invokeai/frontend/webv2/src/workbench/canvas-operations/generationCompositePlan.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvas-operations/generationCompositePlan.test.ts@@ -536,17 +536,25 @@ describe('planRegionalMaskComposites', () => {describe('planComposites — raster adjustments in the base key', () => {it('folds a non-identity adjustment into the base-raster entry (and its key)', () => {const plain = rasterLayer('a');- const adjusted = rasterLayer('a', { adjustments: { brightness: 0.5, contrast: 0, saturation: 0 } });+ const adjusted = rasterLayer('a', {+ adjustments: [+ { brightness: 0.5, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],+ });const plan = planComposites(makeDoc([adjusted]), BBOX);const ref = plan.entries[0]!.layers[0]!;- expect(ref.adjustments).toEqual({ brightness: 0.5, contrast: 0, saturation: 0 });+ expect(ref.adjustments).toEqual(adjusted.type === 'raster' ? adjusted.adjustments : undefined);// A changed adjustment changes the entry key so the executor re-composites/uploads.expect(keyOf(makeDoc([plain]))).not.toBe(keyOf(makeDoc([adjusted])));});it('ignores an identity adjustment (no key churn)', () => {const plain = rasterLayer('a');- const identityAdj = rasterLayer('a', { adjustments: { brightness: 0, contrast: 0, saturation: 0 } });+ const identityAdj = rasterLayer('a', {+ adjustments: [+ { brightness: 0, contrast: 0, id: 'adj-bc', isEnabled: true, type: 'brightness-contrast' as const },+ ],+ });expect(plan0(plain)).toBe(plan0(identityAdj));});});diff --git a/invokeai/frontend/webv2/src/workbench/canvasMigration.test.ts b/invokeai/frontend/webv2/src/workbench/canvasMigration.test.tsindex 46944231ea..4bff5979b7 100644--- a/invokeai/frontend/webv2/src/workbench/canvasMigration.test.ts+++ b/invokeai/frontend/webv2/src/workbench/canvasMigration.test.ts@@ -104,6 +104,53 @@ describe('loadCanvasState', () => {});});+ it('round-trips a valid adjustment stack, drops the pre-stack object shape, and drops a stack with one malformed entry', () => {+ const stack = [+ { brightness: 0.2, contrast: -0.1, id: 'a1', isEnabled: true, type: 'brightness-contrast' },+ { id: 'a2', isEnabled: false, saturation: 0.4, type: 'hsl' },+ {+ curves: {+ r: [+ [0, 10],+ [255, 255],+ ],+ },+ id: 'a3',+ isEnabled: true,+ type: 'curves',+ },+ ];+ const adjustmentsOf = (loaded: CanvasStateContractV3) => {+ const layer = loaded.document.stacks.raster[0];+ return layer?.type === 'raster' ? layer.adjustments : null;+ };++ const valid = load(withNodes([{ ...createEmptyPaintLayer('Adjusted', 'adjusted'), adjustments: stack }]));+ expect(adjustmentsOf(valid)).toEqual(stack);++ const legacy = load(+ withNodes([+ {+ ...createEmptyPaintLayer('Legacy', 'legacy'),+ adjustments: { brightness: 0.2, contrast: 0, saturation: 0 },+ },+ ])+ );+ expect(adjustmentsOf(legacy)).toBeUndefined();++ // One typo'd entry drops the WHOLE stack rather than failing the document — the accepted blast radius.+ const malformed = load(+ withNodes([+ {+ ...createEmptyPaintLayer('Broken', 'broken'),+ adjustments: [stack[0], { id: 'bad', isEnabled: true, saturation: 'high', type: 'hsl' }],+ },+ ])+ );+ expect(adjustmentsOf(malformed)).toBeUndefined();+ expect(malformed.document.stacks.raster).toHaveLength(1);+ });+it('normalizes control adapters in both the live document and saved snapshots', () => {const invalidLayer = {...createControlLayer('Z Control', 'z-control'),diff --git a/invokeai/frontend/webv2/src/workbench/canvasMigration.ts b/invokeai/frontend/webv2/src/workbench/canvasMigration.tsindex b16b076d24..4542d107d3 100644--- a/invokeai/frontend/webv2/src/workbench/canvasMigration.ts+++ b/invokeai/frontend/webv2/src/workbench/canvasMigration.ts@@ -84,12 +84,23 @@ const zTransform = z.object({});const zFilter = z.object({ settings: z.record(z.string(), z.unknown()), type: z.string() });const zCurve = z.array(z.tuple([zFiniteNumber, zFiniteNumber]));-const zAdjustments = z.object({- brightness: zFiniteNumber,- contrast: zFiniteNumber,- curves: z.object({ b: zCurve, g: zCurve, r: zCurve }).optional(),- saturation: zFiniteNumber,-});+const zAdjustmentEntry = z.discriminatedUnion('type', [+ z.object({+ brightness: zFiniteNumber,+ contrast: zFiniteNumber,+ id: z.string(),+ isEnabled: z.boolean(),+ type: z.literal('brightness-contrast'),+ }),+ z.object({ id: z.string(), isEnabled: z.boolean(), saturation: zFiniteNumber, type: z.literal('hsl') }),+ z.object({+ curves: z.object({ b: zCurve.optional(), g: zCurve.optional(), r: zCurve.optional() }),+ id: z.string(),+ isEnabled: z.boolean(),+ type: z.literal('curves'),+ }),+]);+const zAdjustments = z.array(zAdjustmentEntry);const zControlAdapter = z.object({beginEndStepPct: z.tuple([zFiniteNumber, zFiniteNumber]),@@ -180,7 +191,8 @@ const zLayerBase = z.object({});const zCanvasLayer = z.discriminatedUnion('type', [zLayerBase.extend({- adjustments: zAdjustments.optional(),+ // A pre-stack adjustments OBJECT is dropped rather than failing the document.+ adjustments: zAdjustments.optional().catch(undefined),filter: zFilter.optional(),isTransparencyLocked: z.boolean().optional(),source: zLayerSource,diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentsPopover.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.browser.test.tsxsimilarity index 83%rename from invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentsPopover.browser.test.tsxrename to invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.browser.test.tsxindex 61d960c84c..07e0cb3ab1 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentsPopover.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.browser.test.tsx@@ -1,4 +1,8 @@-import type { CanvasRasterLayerContractV2, PreparedDocumentEdit } from '@workbench/canvas-engine/api';+import type {+ CanvasAdjustmentEntry,+ CanvasRasterLayerContractV2,+ PreparedDocumentEdit,+} from '@workbench/canvas-engine/api';/* oxlint-disable react-perf/jsx-no-new-function-as-prop */import type { CanvasProjectMutation } from '@workbench/canvasProjectMutations';@@ -14,7 +18,7 @@ import { createRoot, type Root } from 'react-dom/client';import { I18nextProvider, initReactI18next } from 'react-i18next';import { afterEach, describe, expect, it, vi } from 'vitest';-import { type AdjustmentsEngine, AdjustmentsPopover } from './AdjustmentsPopover';+import { type AdjustmentsEngine, AdjustmentSettings } from './AdjustmentSettings';import { CURVE_SIZE } from './curveEditorMath';const i18n = createInstance();@@ -30,8 +34,14 @@ vi.mock('@workbench/useCanvasProjectMutationDispatch', () => ({let host: HTMLDivElement | null = null;let root: Root | null = null;+const initialEntries = (): CanvasAdjustmentEntry[] => [+ { brightness: 0.1, contrast: 0, id: 'bc1', isEnabled: true, type: 'brightness-contrast' },+ { curves: {}, id: 'cv1', isEnabled: true, type: 'curves' },+];+const createLayer = (): CanvasRasterLayerContractV2 =>({+ adjustments: initialEntries(),blendMode: 'normal',id: 'layer-1',isEnabled: true,@@ -80,7 +90,7 @@ const Harness = () => {// Rebuilt per layer change so the stub's model reflects the previewed layer, as the engine's does.}, [layer]);- return <AdjustmentsPopover engine={engine} layer={layer} />;+ return <AdjustmentSettings engine={engine} entryId="cv1" layer={layer} />;};const settle = (action: () => void): Promise<void> =>@@ -133,8 +143,8 @@ afterEach(async () => {root = null;});-describe('curves editor', () => {- it('moves a handle while dragging it', async () => {+describe('curves entry editor', () => {+ it('moves a handle while dragging and commits the whole stack with the pre-gesture inverse', async () => {const svg = await render();const target = handles(svg).at(-1)!;const before = Number(target.getAttribute('cy'));@@ -151,15 +161,16 @@ describe('curves editor', () => {expect(commits).toHaveLength(1);const edit = commits[0]!;expect(edit.inverse).toMatchObject({ id: 'layer-1', type: 'updateCanvasLayerConfig' });- expect((edit.inverse as { config: { adjustments?: unknown } }).config.adjustments).toEqual(- createLayer().adjustments- );- expect(- (edit.forward as { config: { adjustments: { curves: { r: unknown[] } } } }).config.adjustments.curves.r- ).not.toEqual(createLayer().adjustments?.curves?.r);+ expect((edit.inverse as { config: { adjustments?: unknown } }).config.adjustments).toEqual(initialEntries());+ const forward = (edit.forward as unknown as { config: { adjustments: CanvasAdjustmentEntry[] } }).config+ .adjustments;+ // The untouched sibling entry rides along unchanged; the curves entry carries the new points.+ expect(forward[0]).toEqual(initialEntries()[0]);+ expect(forward[1]).toMatchObject({ id: 'cv1', type: 'curves' });+ expect((forward[1] as { curves: { r?: unknown[] } }).curves.r).toBeDefined();});- it('records nothing when a drag ends where it started', async () => {+ it('records nothing and restores the stack when a drag ends where it started', async () => {const svg = await render();const target = handles(svg).at(-1)!;const before = Number(target.getAttribute('cy'));@@ -172,10 +183,10 @@ describe('curves editor', () => {expect(Number(handles(svg).at(-1)!.getAttribute('cy'))).toBeCloseTo(before, 5);expect(commits).toHaveLength(0);- expect(latestAdjustments).toBeUndefined();+ expect(latestAdjustments).toEqual(initialEntries());});- it('restores the pre-drag curve and records nothing when the drag is cancelled', async () => {+ it('restores the pre-drag stack and records nothing when the drag is cancelled', async () => {const svg = await render();const target = handles(svg).at(-1)!;const before = Number(target.getAttribute('cy'));@@ -187,7 +198,7 @@ describe('curves editor', () => {expect(Number(handles(svg).at(-1)!.getAttribute('cy'))).toBeCloseTo(before, 5);expect(commits).toHaveLength(0);- expect(latestAdjustments).toBeUndefined();+ expect(latestAdjustments).toEqual(initialEntries());});it('adds a point under the pointer rather than offset from it', async () => {diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentsPopover.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsxsimilarity index 62%rename from invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentsPopover.tsxrename to invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsxindex f7f6ca69ae..311b066cc9 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentsPopover.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/AdjustmentSettings.tsx@@ -1,12 +1,16 @@import type { SliderValueChangeDetails } from '@chakra-ui/react';-import type { CanvasAdjustmentsContract, CanvasRasterLayerContractV2 } from '@workbench/canvas-engine/api';+import type {+ CanvasAdjustmentCurves,+ CanvasAdjustmentEntry,+ CanvasRasterLayerContractV2,+} from '@workbench/canvas-engine/api';import type { CanvasPreparedEngine } from '@workbench/widgets/canvas/useStructuralCommit';import type { CanvasStructuralEngine } from '@workbench/widgets/layers/layerOps';import type { PointerEvent as ReactPointerEvent } from 'react';import { chakra, createListCollection, HStack, Stack, Text } from '@chakra-ui/react';-import { Button, Field, Select, Slider } from '@platform/ui';-import { DEFAULT_ADJUSTMENTS, buildCurveLut } from '@workbench/canvas-engine/api';+import { Field, Select, Slider } from '@platform/ui';+import { buildCurveLut } from '@workbench/canvas-engine/api';import { usePreparedCommit } from '@workbench/widgets/canvas/useStructuralCommit';import { useCallback, useMemo, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -21,6 +25,16 @@ import {} from './curveEditorMath';import { applyStructuralPreview } from './layerOps';+/**+ * The dedicated Properties editors of a raster layer's adjustment entries —+ * the views their tree sub-selections open. Every edit replaces the layer's+ * whole `adjustments` stack through one `patch-config`; a gesture previews+ * live and lands exactly one history entry. Enable/remove/reorder live on the+ * tree row, never here.+ */++export type AdjustmentsEngine = CanvasStructuralEngine & CanvasPreparedEngine;+const SELECT_POSITIONING = { placement: 'bottom-end', sameWidth: false } as const;const CurveSvg = chakra('svg');@@ -52,206 +66,186 @@ const IDENTITY_CURVE: [number, number][] = [[255, 255],];-const withCurve = (- base: CanvasAdjustmentsContract,- channel: CurveChannel,- points: [number, number][]-): CanvasAdjustmentsContract => ({- ...base,- curves: {- b: base.curves?.b ?? IDENTITY_CURVE,- g: base.curves?.g ?? IDENTITY_CURVE,- r: base.curves?.r ?? IDENTITY_CURVE,- [channel]: points,- },-});--const sameCurves = (left: CanvasAdjustmentsContract, right: CanvasAdjustmentsContract): boolean =>- CURVE_CHANNELS.every(- (channel) =>- JSON.stringify(left.curves?.[channel] ?? IDENTITY_CURVE) ===- JSON.stringify(right.curves?.[channel] ?? IDENTITY_CURVE)- );-const formatSigned = (value: number): string => `${value > 0 ? '+' : ''}${Math.round(value * 100)}`;-interface AdjustmentsPopoverProps {+export const AdjustmentSettings = ({+ engine,+ entryId,+ layer,+}: {engine: AdjustmentsEngine | null;+ entryId: string;layer: CanvasRasterLayerContractV2;-}--export const AdjustmentsPopover = ({ engine, layer }: AdjustmentsPopoverProps) => {- const adjustments = layer.adjustments ?? DEFAULT_ADJUSTMENTS;- return <AdjustmentsControls adjustments={adjustments} engine={engine} layer={layer} />;+}) => {+ const entry = layer.adjustments?.find((candidate) => candidate.id === entryId);+ if (!entry) {+ return null;+ }+ return <AdjustmentEntryEditor engine={engine} entry={entry} layer={layer} />;};-export type AdjustmentsEngine = CanvasStructuralEngine & CanvasPreparedEngine;--interface AdjustmentsControlsProps {- adjustments: CanvasAdjustmentsContract;+const AdjustmentEntryEditor = ({+ engine,+ entry,+ layer,+}: {engine: AdjustmentsEngine | null;+ entry: CanvasAdjustmentEntry;layer: CanvasRasterLayerContractV2;-}--type ScalarKey = 'brightness' | 'contrast' | 'saturation';--const AdjustmentsControls = ({ adjustments, engine, layer }: AdjustmentsControlsProps) => {+}) => {const commitPrepared = usePreparedCommit(engine);const { t } = useTranslation();- // The layer's adjustments when the current gesture started; `undefined` when it had none, so undo- // restores "no adjustments" rather than the defaults the controls display.- const gestureBaselineRef = useRef<{ adjustments: CanvasAdjustmentsContract | undefined } | null>(null);+ // The whole stack when the current gesture started; undo restores it entirely.+ const gestureBaselineRef = useRef<readonly CanvasAdjustmentEntry[] | null>(null);const patchLive = useCallback(- (next: CanvasAdjustmentsContract) => {- gestureBaselineRef.current ??= { adjustments: layer.adjustments };+ (next: CanvasAdjustmentEntry) => {+ const entries = layer.adjustments ?? [];+ gestureBaselineRef.current ??= entries;applyStructuralPreview(engine, {- config: { adjustments: next, layerType: 'raster' },+ config: {+ adjustments: entries.map((candidate) => (candidate.id === next.id ? next : candidate)),+ layerType: 'raster',+ },id: layer.id,type: 'updateCanvasLayerConfig',});},- [engine, layer]+ [engine, layer.adjustments, layer.id]);- const commit = useCallback(- (label: string, next: CanvasAdjustmentsContract, before: CanvasAdjustmentsContract) => {- const baseline = gestureBaselineRef.current ? gestureBaselineRef.current.adjustments : before;+ const commitEntry = useCallback(+ (label: string, next: CanvasAdjustmentEntry) => {+ const entries = layer.adjustments ?? [];+ const baseline = gestureBaselineRef.current ?? entries;gestureBaselineRef.current = null;+ // The tree dot owns enablement; a toggle landing mid-gesture stays put.+ const committed = { ...next, isEnabled: entry.isEnabled };commitPrepared(label, (model) =>model.prepare({- before: { adjustments: baseline, layerType: 'raster' },- config: { adjustments: next, layerType: 'raster' },+ before: { adjustments: [...baseline], layerType: 'raster' },+ config: {+ adjustments: entries.map((candidate) => (candidate.id === committed.id ? committed : candidate)),+ layerType: 'raster',+ },id: layer.id,type: 'patch-config',}));},- [commitPrepared, layer.id]- );-- const handleScalarLive = useCallback(- (key: ScalarKey, next: number) => patchLive({ ...adjustments, [key]: next }),- [adjustments, patchLive]- );-- const handleScalarCommit = useCallback(- (label: string, key: ScalarKey, next: number, before: CanvasAdjustmentsContract) => {- commit(label, { ...before, [key]: next }, before);- },- [commit]+ [commitPrepared, entry.isEnabled, layer.adjustments, layer.id]);- const handleReset = useCallback(() => {- commit(t('widgets.layers.adjustments.reset'), { ...DEFAULT_ADJUSTMENTS }, adjustments);- }, [adjustments, commit, t]);-- const handleCurveLive = useCallback(- (channel: CurveChannel, points: [number, number][]) => {- patchLive(withCurve(adjustments, channel, points));- },- [adjustments, patchLive]- );-- const handleCurveCancel = useCallback(- (before: CanvasAdjustmentsContract) => {- const baseline = gestureBaselineRef.current ? gestureBaselineRef.current.adjustments : before;- gestureBaselineRef.current = null;+ const cancelGesture = useCallback(() => {+ const baseline = gestureBaselineRef.current;+ gestureBaselineRef.current = null;+ if (baseline) {applyStructuralPreview(engine, {- config: { adjustments: baseline, layerType: 'raster' },+ config: { adjustments: [...baseline], layerType: 'raster' },id: layer.id,type: 'updateCanvasLayerConfig',});- },- [engine, layer.id]- );+ }+ }, [engine, layer.id]);- const handleCurveCommit = useCallback(- (current: CanvasAdjustmentsContract, before: CanvasAdjustmentsContract) => {- if (sameCurves(current, before)) {- handleCurveCancel(before);- return;- }- commit(t('widgets.layers.adjustments.curves'), current, before);- },- [commit, handleCurveCancel, t]+ const handleScalarLive = useCallback(+ (field: 'brightness' | 'contrast' | 'saturation', next: number) =>+ patchLive({ ...entry, [field]: next } as CanvasAdjustmentEntry),+ [entry, patchLive]);-- return (- <Stack gap="3">- <AdjustmentSlider- adjustments={adjustments}- adjustmentKey="brightness"- label={t('widgets.layers.adjustments.brightness')}- onCommit={handleScalarCommit}- onLive={handleScalarLive}- />- <AdjustmentSlider- adjustments={adjustments}- adjustmentKey="contrast"- label={t('widgets.layers.adjustments.contrast')}- onCommit={handleScalarCommit}- onLive={handleScalarLive}- />- <AdjustmentSlider- adjustments={adjustments}- adjustmentKey="saturation"- label={t('widgets.layers.adjustments.saturation')}- onCommit={handleScalarCommit}- onLive={handleScalarLive}- />- <CurvesEditor- adjustments={adjustments}- onCancel={handleCurveCancel}- onCommit={handleCurveCommit}- onLive={handleCurveLive}- />- <Button size="xs" variant="ghost" onClick={handleReset}>- {t('widgets.layers.adjustments.reset')}- </Button>- </Stack>+ const handleScalarCommit = useCallback(+ (field: 'brightness' | 'contrast' | 'saturation', next: number) =>+ commitEntry(t(`widgets.layers.adjustments.${field}`), { ...entry, [field]: next } as CanvasAdjustmentEntry),+ [commitEntry, entry, t]+ );+ const handleCurvesLive = useCallback(+ (curves: CanvasAdjustmentCurves) => patchLive({ ...entry, curves } as CanvasAdjustmentEntry),+ [entry, patchLive]+ );+ const handleCurvesCommit = useCallback(+ (curves: CanvasAdjustmentCurves) =>+ commitEntry(t('widgets.layers.adjustments.curves'), { ...entry, curves } as CanvasAdjustmentEntry),+ [commitEntry, entry, t]);++ switch (entry.type) {+ case 'brightness-contrast':+ return (+ <Stack gap="3">+ <ScalarSlider+ field="brightness"+ label={t('widgets.layers.adjustments.brightness')}+ value={entry.brightness}+ onCommit={handleScalarCommit}+ onLive={handleScalarLive}+ />+ <ScalarSlider+ field="contrast"+ label={t('widgets.layers.adjustments.contrast')}+ value={entry.contrast}+ onCommit={handleScalarCommit}+ onLive={handleScalarLive}+ />+ </Stack>+ );+ case 'hsl':+ return (+ <ScalarSlider+ field="saturation"+ label={t('widgets.layers.adjustments.saturation')}+ value={entry.saturation}+ onCommit={handleScalarCommit}+ onLive={handleScalarLive}+ />+ );+ case 'curves':+ return (+ <CurvesEditor+ curves={entry.curves}+ onCancel={cancelGesture}+ onCommit={handleCurvesCommit}+ onLive={handleCurvesLive}+ />+ );+ }};-interface AdjustmentSliderProps {+type ScalarField = 'brightness' | 'contrast' | 'saturation';++const ScalarSlider = ({+ field,+ label,+ onCommit,+ onLive,+ value,+}: {+ field: ScalarField;label: string;- adjustmentKey: ScalarKey;- adjustments: CanvasAdjustmentsContract;- onLive: (key: ScalarKey, next: number) => void;- onCommit: (label: string, key: ScalarKey, next: number, before: CanvasAdjustmentsContract) => void;-}--const AdjustmentSlider = ({ adjustmentKey, adjustments, label, onCommit, onLive }: AdjustmentSliderProps) => {- const beforeRef = useRef<CanvasAdjustmentsContract | null>(null);- const value = adjustments[adjustmentKey] ?? 0;+ value: number;+ onLive: (field: ScalarField, next: number) => void;+ onCommit: (field: ScalarField, next: number) => void;+}) => {const sliderValue = useMemo(() => [value], [value]);const aria = useMemo(() => [label], [label]);const handleChange = useCallback(({ value: v }: SliderValueChangeDetails) => {const next = v[0];- if (next === undefined || !Number.isFinite(next)) {- return;- }- if (beforeRef.current === null) {- beforeRef.current = adjustments;+ if (next !== undefined && Number.isFinite(next)) {+ onLive(field, next);}- onLive(adjustmentKey, next);},- [adjustmentKey, adjustments, onLive]+ [field, onLive]);const handleChangeEnd = useCallback(({ value: v }: SliderValueChangeDetails) => {const next = v[0];- const before = beforeRef.current ?? adjustments;- beforeRef.current = null;- if (next === undefined || !Number.isFinite(next)) {- return;+ if (next !== undefined && Number.isFinite(next)) {+ onCommit(field, next);}- onCommit(label, adjustmentKey, next, before);},- [adjustmentKey, adjustments, label, onCommit]+ [field, onCommit]);return (@@ -272,26 +266,32 @@ const AdjustmentSlider = ({ adjustmentKey, adjustments, label, onCommit, onLive);};-interface CurvesEditorProps {- adjustments: CanvasAdjustmentsContract;- onLive: (channel: CurveChannel, points: [number, number][]) => void;- onCancel: (before: CanvasAdjustmentsContract) => void;- onCommit: (current: CanvasAdjustmentsContract, before: CanvasAdjustmentsContract) => void;-}--const CurvesEditor = ({ adjustments, onCancel, onCommit, onLive }: CurvesEditorProps) => {+const sameChannel = (left: CanvasAdjustmentCurves, right: CanvasAdjustmentCurves, channel: CurveChannel): boolean =>+ JSON.stringify(left[channel] ?? IDENTITY_CURVE) === JSON.stringify(right[channel] ?? IDENTITY_CURVE);++const CurvesEditor = ({+ curves,+ onCancel,+ onCommit,+ onLive,+}: {+ curves: CanvasAdjustmentCurves;+ onLive: (curves: CanvasAdjustmentCurves) => void;+ onCancel: () => void;+ onCommit: (curves: CanvasAdjustmentCurves) => void;+}) => {const { t } = useTranslation();const [channel, setChannel] = useState<CurveChannel>('r');const dragIndexRef = useRef<number | null>(null);const svgRef = useRef<SVGSVGElement | null>(null);- const beforeRef = useRef<CanvasAdjustmentsContract | null>(null);+ const beforeRef = useRef<CanvasAdjustmentCurves | null>(null);const latestPointsRef = useRef<[number, number][] | null>(null);const dragTargetRef = useRef<Element | null>(null);const points = useMemo<[number, number][]>(() => {- const raw = adjustments.curves?.[channel];+ const raw = curves[channel];return raw && raw.length >= 2 ? [...raw].map(([x, y]) => [x, y] as [number, number]) : [...IDENTITY_CURVE];- }, [adjustments.curves, channel]);+ }, [channel, curves]);const channelCollection = useMemo(() =>@@ -336,10 +336,10 @@ const CurvesEditor = ({ adjustments, onCancel, onCommit, onLive }: CurvesEditorPevent.currentTarget.setPointerCapture(event.pointerId);dragIndexRef.current = Number(event.currentTarget.dataset.index);dragTargetRef.current = event.currentTarget;- beforeRef.current = adjustments;+ beforeRef.current = curves;latestPointsRef.current = null;},- [adjustments]+ [curves]);const handleMove = useCallback(@@ -363,9 +363,9 @@ const CurvesEditor = ({ adjustments, onCancel, onCommit, onLive }: CurvesEditorPnext[index] = [Math.max(lo, Math.min(hi, next[index][0])), next[index][1]];}latestPointsRef.current = next;- onLive(channel, next);+ onLive({ ...curves, [channel]: next });},- [channel, onLive, points, svgPointFromEvent]+ [channel, curves, onLive, points, svgPointFromEvent]);const finishDrag = useCallback(@@ -382,12 +382,13 @@ const CurvesEditor = ({ adjustments, onCancel, onCommit, onLive }: CurvesEditorPbeforeRef.current = null;latestPointsRef.current = null;if (wasDragging && before && finalPoints) {+ const current = { ...before, [channel]: finalPoints };finishCurveDragResult({before,- cancelled,- current: withCurve(before, channel, finalPoints),- onCommit: (current) => onCommit(current, before),- onPreview: onCancel,+ cancelled: cancelled || sameChannel(current, before, channel),+ current,+ onCommit,+ onPreview: () => onCancel(),});}},@@ -408,9 +409,9 @@ const CurvesEditor = ({ adjustments, onCancel, onCommit, onLive }: CurvesEditorPreturn;}const next = [...points, [nx, ny] as [number, number]].sort((a, b) => a[0] - b[0]);- onCommit(withCurve(adjustments, channel, next), adjustments);+ onCommit({ ...curves, [channel]: next });},- [adjustments, channel, onCommit, points, svgPointFromEvent]+ [channel, curves, onCommit, points, svgPointFromEvent]);const handleRemove = useCallback(@@ -420,16 +421,9 @@ const CurvesEditor = ({ adjustments, onCancel, onCommit, onLive }: CurvesEditorPif (index === 0 || index === points.length - 1 || points.length <= 2) {return;}- onCommit(- withCurve(- adjustments,- channel,- points.filter((_, i) => i !== index)- ),- adjustments- );+ onCommit({ ...curves, [channel]: points.filter((_, i) => i !== index) });},- [adjustments, channel, onCommit, points]+ [channel, curves, onCommit, points]);const channelValue = useMemo(() => [channel], [channel]);diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildMenu.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildMenu.tsxindex 8b6e628082..9f1e403bb5 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildMenu.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildMenu.tsx@@ -2,13 +2,36 @@ import type { ComponentProps } from 'react';import { HStack, Icon, Menu, Portal, Text } from '@chakra-ui/react';import { MenuContent } from '@platform/ui';-import { CircleIcon, CircleOffIcon, XIcon } from 'lucide-react';+import { ArrowDownIcon, ArrowUpIcon, CircleIcon, CircleOffIcon, CopyIcon, XIcon, type LucideIcon } from 'lucide-react';import { useCallback, useMemo } from 'react';import { useTranslation } from 'react-i18next';import type { LayerRowCommands, LayerSurfaceAnchor } from './layerRowCommands';-import { layerChildRemoveLabelKey, type ProjectedChildRow } from './layerChildRows';+import { isOrderedChildKind, layerChildRemoveLabelKey, type ProjectedChildRow } from './layerChildRows';++const ChildMenuItem = ({+ disabled,+ icon,+ label,+ tone,+ value,+ onSelect,+}: {+ disabled: boolean;+ icon: LucideIcon;+ label: string;+ tone?: 'danger';+ value: string;+ onSelect: () => void;+}) => (+ <Menu.Item color={tone === 'danger' ? 'fg.error' : undefined} disabled={disabled} value={value} onSelect={onSelect}>+ <HStack gap="2">+ <Icon as={icon} boxSize="3.5" color={tone === 'danger' ? undefined : 'fg.muted'} />+ <Text fontSize="xs">{label}</Text>+ </HStack>+ </Menu.Item>+);type MenuPositioning = ComponentProps<typeof Menu.Root>['positioning'];@@ -41,26 +64,56 @@ export const LayerChildMenu = ({);const handleToggle = useCallback(() => commands.setChildEnabled(child, !child.isEnabled), [child, commands]);const handleRemove = useCallback(() => commands.removeChild(child), [child, commands]);+ const handleDuplicate = useCallback(() => commands.duplicateChild(child), [child, commands]);+ const handleMoveUp = useCallback(() => commands.moveChild(child, -1), [child, commands]);+ const handleMoveDown = useCallback(() => commands.moveChild(child, 1), [child, commands]);+ const ordered = isOrderedChildKind(child.kind);return (<Menu.Root lazyMount open positioning={positioning} unmountOnExit onOpenChange={handleOpenChange}><Portal><Menu.Positioner><MenuContent minW="10rem">- <Menu.Item disabled={editingLocked} value="toggle" onSelect={handleToggle}>- <HStack gap="2">- <Icon as={child.isEnabled ? CircleOffIcon : CircleIcon} boxSize="3.5" color="fg.muted" />- <Text fontSize="xs">- {t(child.isEnabled ? 'widgets.layers.modifiers.disable' : 'widgets.layers.modifiers.enable')}- </Text>- </HStack>- </Menu.Item>- <Menu.Item color="fg.error" disabled={editingLocked} value="remove" onSelect={handleRemove}>- <HStack gap="2">- <Icon as={XIcon} boxSize="3.5" />- <Text fontSize="xs">{t(layerChildRemoveLabelKey(child.kind))}</Text>- </HStack>- </Menu.Item>+ <ChildMenuItem+ disabled={editingLocked}+ icon={child.isEnabled ? CircleOffIcon : CircleIcon}+ label={t(child.isEnabled ? 'widgets.layers.modifiers.disable' : 'widgets.layers.modifiers.enable')}+ value="toggle"+ onSelect={handleToggle}+ />+ {ordered ? (+ <>+ <ChildMenuItem+ disabled={editingLocked}+ icon={CopyIcon}+ label={t('widgets.layers.modifiers.duplicateAdjustment')}+ value="duplicate"+ onSelect={handleDuplicate}+ />+ <ChildMenuItem+ disabled={editingLocked || child.posInSet <= 1}+ icon={ArrowUpIcon}+ label={t('widgets.layers.modifiers.moveUp')}+ value="move-up"+ onSelect={handleMoveUp}+ />+ <ChildMenuItem+ disabled={editingLocked || child.posInSet >= child.setSize}+ icon={ArrowDownIcon}+ label={t('widgets.layers.modifiers.moveDown')}+ value="move-down"+ onSelect={handleMoveDown}+ />+ </>+ ) : null}+ <ChildMenuItem+ disabled={editingLocked}+ icon={XIcon}+ label={t(layerChildRemoveLabelKey(child.kind))}+ tone="danger"+ value="remove"+ onSelect={handleRemove}+ /></MenuContent></Menu.Positioner></Portal>diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsxindex 33a7e7f5de..3b037a1b0a 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerChildRow.tsx@@ -3,7 +3,7 @@ import type { CSSProperties, KeyboardEvent, MouseEvent } from 'react';import { Box, Icon, Text } from '@chakra-ui/react';import { useDroppable } from '@dnd-kit/core';import { Row } from '@platform/ui';-import { GaugeIcon, ImageIcon, WavesIcon, type LucideIcon } from 'lucide-react';+import { DropletIcon, GaugeIcon, ImageIcon, SplineIcon, SunMediumIcon, WavesIcon, type LucideIcon } from 'lucide-react';import { memo, useCallback, useMemo, useRef } from 'react';import { useTranslation } from 'react-i18next';@@ -17,12 +17,15 @@ import { anchorFromPoint } from './layerRowCommands';const THUMBNAIL_IMG_STYLE: CSSProperties = { height: '100%', objectFit: 'cover', width: '100%' };const CHILD_ROW_GLYPHS: Record<LayerChildRowKind, LucideIcon> = {+ 'adjustment-brightness-contrast': SunMediumIcon,+ 'adjustment-curves': SplineIcon,+ 'adjustment-hsl': DropletIcon,'mask-denoise': GaugeIcon,'mask-noise': WavesIcon,'reference-image': ImageIcon,};-/** The row's display name; reference images are numbered, singleton modifiers named by kind. */+/** The row's display name; reference images are numbered, other modifiers named by kind. */const childRowName = (child: ProjectedChildRow, t: (key: string) => string): string => {switch (child.kind) {case 'reference-image':@@ -31,6 +34,12 @@ const childRowName = (child: ProjectedChildRow, t: (key: string) => string): strreturn t('widgets.layers.modifiers.noise');case 'mask-denoise':return t('widgets.layers.modifiers.denoise');+ case 'adjustment-brightness-contrast':+ return t('widgets.layers.modifiers.brightnessContrast');+ case 'adjustment-hsl':+ return t('widgets.layers.adjustments.saturation');+ case 'adjustment-curves':+ return t('widgets.layers.adjustments.curves');}};diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsxindex 16de0a9a14..3dc8d9285d 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerContextMenu.tsx@@ -48,6 +48,7 @@ import {CopyIcon,MergeIcon,MoreVerticalIcon,+ SlidersHorizontalIcon,} from 'lucide-react';import { Fragment, useCallback, useMemo, useState } from 'react';import { useTranslation } from 'react-i18next';@@ -99,6 +100,7 @@ import {copyRasterToRegionalGuidance,copyRegionalGuidanceToInpaintMask,createLayerId,+ createAdjustmentId,createRegionalReferenceImage,fitLayerTransformToBbox,getControlTransparencyEffectPatch,@@ -733,6 +735,31 @@ const LayerMenu = ({[commitPrepared, layer, t]);+ const handleAddAdjustment = useCallback(+ (type: 'brightness-contrast' | 'hsl' | 'curves') => {+ if (layer.type !== 'raster') {+ return;+ }+ const id = createAdjustmentId();+ const entry =+ type === 'brightness-contrast'+ ? { brightness: 0, contrast: 0, id, isEnabled: true, type }+ : type === 'hsl'+ ? { id, isEnabled: true, saturation: 0, type }+ : { curves: {}, id, isEnabled: true, type };+ const before = layer.adjustments ?? [];+ commitPrepared(t('widgets.layers.menu.addAdjustment'), (model) =>+ model.prepare({+ before: { adjustments: [...before], layerType: 'raster' },+ config: { adjustments: [...before, entry], layerType: 'raster' },+ id: layer.id,+ type: 'patch-config',+ })+ );+ },+ [commitPrepared, layer, t]+ );+const handleAddReferenceImage = useCallback(() => {if (layer.type !== 'regional_guidance') {return;@@ -752,6 +779,7 @@ const LayerMenu = ({const effects = useMemo<LayerContextActionEffects>(() => ({+ addAdjustment: handleAddAdjustment,addMaskModifier: handleAddMaskModifier,addReferenceImage: handleAddReferenceImage,booleanMerge: handleBooleanRaster,@@ -793,6 +821,7 @@ const LayerMenu = ({[convert,getActionLabel,+ handleAddAdjustment,handleAddMaskModifier,handleAddReferenceImage,handleBooleanRaster,@@ -1023,6 +1052,11 @@ export const CanvasLayerContextMenu = ({const stopPropagation = (event: { stopPropagation: () => void }): void => event.stopPropagation();const SUBMENU_META: Record<LayerContextSubmenuId, { defaultLabel: string; icon: LucideIcon; labelKey: string }> = {+ 'add-adjustment': {+ defaultLabel: 'Add adjustment',+ icon: SlidersHorizontalIcon,+ labelKey: 'widgets.layers.menu.addAdjustment',+ },arrange: { defaultLabel: 'Arrange', icon: ArrowUpDownIcon, labelKey: 'widgets.layers.menu.arrange' },boolean: { defaultLabel: 'Boolean operations', icon: MergeIcon, labelKey: 'widgets.layers.menu.booleanOperations' },'convert-to': { defaultLabel: 'Convert to', icon: ArrowRightLeftIcon, labelKey: 'widgets.layers.menu.convertTo' },diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerSurfaceHost.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerSurfaceHost.tsxindex 19634faf1a..2a2f6c589d 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerSurfaceHost.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayerSurfaceHost.tsx@@ -57,7 +57,10 @@ export const LayerSurfaceHost = ({[node, surface]);const handleMenuClose = useCallback(() => onClose(), [onClose]);- // The child menu labels and toggles the item's LIVE state, not its state at open.+ // The child menu labels and toggles the item's LIVE state, not its state at+ // open. Ordering facts (posInSet/setSize) stay the open-time snapshot: a+ // stale Move up/down is safe because the command re-validates against the+ // live document and refuses moves past the ends.const liveChild = useMemo(() => {if (surface?.kind !== 'child-menu') {return null;diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.browser.test.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.browser.test.tsxindex 0606ac3e00..12d1074c07 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.browser.test.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.browser.test.tsx@@ -97,13 +97,18 @@ void i18n.use(initReactI18next).init({toggleActive: 'Toggle layer active',toggleVisibility: 'Toggle visibility',},+ adjustments: { curves: 'Curves', saturation: 'Saturation' },modifiers: {+ brightnessContrast: 'Brightness/Contrast',denoise: 'Denoise limit',disable: 'Disable',+ duplicateAdjustment: 'Duplicate adjustment',enable: 'Enable',noise: 'Noise',+ removeAdjustment: 'Remove adjustment',removeDenoise: 'Remove denoise limit',removeNoise: 'Remove noise',+ reorderAdjustment: 'Reorder adjustment',toggleActive: 'Toggle active',},regionalGuidance: {@@ -208,6 +213,14 @@ const Harness = ({ initialNodes }: { initialNodes: CanvasNodeContract[] }) => {<output data-testid="selected-layer" style={HIDDEN}>{document.selectedLayerId ?? 'none'}</output>+ <output data-testid="raster-adjustments" style={HIDDEN}>+ {(() => {+ const layer = getDocumentLayer(document, 'r1');+ return layer?.type === 'raster'+ ? (layer.adjustments?.map((entry) => `${entry.id}:${entry.isEnabled ? 'on' : 'off'}`).join(',') ?? 'none')+ : 'none';+ })()}+ </output><output data-testid="mask-modifiers" style={HIDDEN}>{(() => {const layer = getDocumentLayer(document, 'mask');@@ -649,6 +662,26 @@ describe('LayersTree projected child rows', () => {expect(document.activeElement).toBe(treeitem('Mask'));});+ it('projects adjustment rows in stack order; the dot toggles one entry', async () => {+ await renderTree([+ layerContract('r1', 'raster', {+ adjustments: [+ { brightness: 0.2, contrast: 0, id: 'a1', isEnabled: true, type: 'brightness-contrast' },+ { id: 'a2', isEnabled: true, saturation: -0.4, type: 'hsl' },+ { curves: {}, id: 'a3', isEnabled: true, type: 'curves' },+ ],+ name: 'Painting',+ }),+ ]);+ expect(treeitem('Brightness/Contrast')).toHaveAttribute('aria-posinset', '1');+ expect(treeitem('Saturation')).toHaveAttribute('aria-posinset', '2');+ expect(treeitem('Curves')).toHaveAttribute('aria-setsize', '3');+ expect(treeitem('Saturation').textContent).toContain('-40%');+ const dot = treeitem('Saturation').querySelector<HTMLButtonElement>('button[aria-label="Toggle active"]')!;+ await act(() => userEvent.click(dot));+ expect(output('raster-adjustments')).toBe('a1:on,a2:off,a3:on');+ });+it('walks child rows from the keyboard and routes their context menu', async () => {await renderTree(regionWithRefs());treeitem('Region').focus();diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsxindex f335accdbe..343932783d 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/LayersTree.tsx@@ -37,6 +37,7 @@ import {type ProjectedChildRow,} from './layerChildRows';import { clearLayerChildSelection, selectLayerChild, useLayerChildSelection } from './layerChildSelection';+import { createAdjustmentId } from './layerOps';import {flattenPanelRows,isHeaderKey,@@ -483,6 +484,21 @@ export const LayersTree = ({}focusItem(navigation.focus);},+ duplicateChild: (child) => {+ const command = layerChildRowCommand(latest.current.document, child, {+ newId: createAdjustmentId(),+ type: 'duplicate',+ });+ if (command) {+ runStructural(t('widgets.layers.modifiers.duplicateAdjustment'), command);+ }+ },+ moveChild: (child, direction) => {+ const command = layerChildRowCommand(latest.current.document, child, { direction, type: 'move' });+ if (command) {+ runStructural(t('widgets.layers.modifiers.reorderAdjustment'), command);+ }+ },openChildMenu: (child, anchor: LayerSurfaceAnchor) => setSurface({ anchor, child, kind: 'child-menu' }),openMenu: (id, anchor: LayerSurfaceAnchor) => setSurface({ anchor, id, kind: 'menu' }),openStackMenu: (stack, anchor: LayerSurfaceAnchor) => setSurface({ anchor, kind: 'stack-menu', stack }),diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/curveEditorMath.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/curveEditorMath.test.tsindex c1d1f78e23..8e5693ec9c 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/curveEditorMath.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/curveEditorMath.test.ts@@ -1,10 +1,8 @@-import type { CanvasAdjustmentsContract } from '@workbench/canvas-engine/contracts';-import { describe, expect, it, vi } from 'vitest';import { curvePointFromSvg, curvePointToSvg, finishCurveDragResult, getCurveGridCoordinates } from './curveEditorMath';-const BEFORE: CanvasAdjustmentsContract = {+const BEFORE = {brightness: 0,contrast: 0,curves: {@@ -24,10 +22,10 @@ const BEFORE: CanvasAdjustmentsContract = {saturation: 0,};-const CURRENT: CanvasAdjustmentsContract = {+const CURRENT = {...BEFORE,curves: {- ...BEFORE.curves!,+ ...BEFORE.curves,r: [[0, 32],[255, 255],diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/curveEditorMath.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/curveEditorMath.tsindex daed6d6cf3..87730ab6c1 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/curveEditorMath.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/curveEditorMath.ts@@ -1,5 +1,3 @@-import type { CanvasAdjustmentsContract } from '@workbench/canvas-engine/api';-export const CURVE_SIZE = 180;export const CURVE_PADDING = 6;@@ -9,21 +7,21 @@ const clamp255 = (value: number): number => Math.max(0, Math.min(255, value));export const getCurveGridCoordinates = (): number[] =>Array.from({ length: 5 }, (_, index) => CURVE_PADDING + (index / 4) * CURVE_DRAW_SIZE);-interface FinishCurveDragResultArgs {+interface FinishCurveDragResultArgs<T> {cancelled: boolean;- before: CanvasAdjustmentsContract;- current: CanvasAdjustmentsContract;- onPreview: (adjustments: CanvasAdjustmentsContract) => void;- onCommit: (adjustments: CanvasAdjustmentsContract) => void;+ before: T;+ current: T;+ onPreview: (value: T) => void;+ onCommit: (value: T) => void;}-export const finishCurveDragResult = ({+export const finishCurveDragResult = <T>({before,cancelled,current,onCommit,onPreview,-}: FinishCurveDragResultArgs): void => {+}: FinishCurveDragResultArgs<T>): void => {if (cancelled) {onPreview(before);return;diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.test.tsindex 305ed8c289..2282a3dfe0 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.test.ts@@ -163,3 +163,69 @@ describe('mask modifier rows', () => {expect(getLayerChildItem(document, 'gone', 'noise')).toBeNull();});});++describe('adjustment rows', () => {+ const entries = () => [+ { brightness: 0.1, contrast: 0, id: 'a1', isEnabled: true, type: 'brightness-contrast' as const },+ { id: 'a2', isEnabled: false, saturation: -0.4, type: 'hsl' as const },+ { curves: {}, id: 'a3', isEnabled: true, type: 'curves' as const },+ ];+ const rasterWith = (adjustments = entries()) => layerContract('r1', 'raster', { adjustments });+ const rasterRow = (document: ReturnType<typeof documentFrom>) =>+ buildLayerStackRows(document.stacks, new Set()).raster.rows.find((row) => row.id === 'r1')!;++ it('projects one row per entry, in stack order, with per-kind identity and the hsl value', () => {+ const rows = projectLayerChildRows(rasterRow(documentFrom([rasterWith()])).vm);+ expect(rows.map((row) => [row.kind, row.itemId, row.isEnabled, row.value])).toEqual([+ ['adjustment-brightness-contrast', 'a1', true, null],+ ['adjustment-hsl', 'a2', false, -0.4],+ ['adjustment-curves', 'a3', true, null],+ ]);+ expect(rows[1]).toMatchObject({ posInSet: 2, setSize: 3 });+ expect(projectLayerChildRows(rasterRow(documentFrom([rasterWith([])])).vm)).toEqual([]);+ });++ it('moves an entry within the stack and refuses moves past the ends', () => {+ const document = documentFrom([rasterWith()]);+ const moved = layerChildRowCommand(document, { itemId: 'a2', layerId: 'r1' }, { direction: -1, type: 'move' });+ expect(+ (moved!.config as unknown as { adjustments: { id: string }[] }).adjustments.map((entry) => entry.id)+ ).toEqual(['a2', 'a1', 'a3']);+ expect(layerChildRowCommand(document, { itemId: 'a1', layerId: 'r1' }, { direction: -1, type: 'move' })).toBeNull();+ expect(layerChildRowCommand(document, { itemId: 'a3', layerId: 'r1' }, { direction: 1, type: 'move' })).toBeNull();+ });++ it('duplicates an entry directly after itself with the minted id', () => {+ const document = documentFrom([rasterWith()]);+ const command = layerChildRowCommand(+ document,+ { itemId: 'a1', layerId: 'r1' },+ { newId: 'a1-copy', type: 'duplicate' }+ );+ const ids = (command!.config as unknown as { adjustments: { id: string }[] }).adjustments.map((entry) => entry.id);+ expect(ids).toEqual(['a1', 'a1-copy', 'a2', 'a3']);+ });++ it('toggles and removes entries, and refuses move/duplicate for non-adjustment kinds', () => {+ const document = documentFrom([rasterWith(), regionalWith([referenceImage('ref1')])]);+ const toggled = layerChildRowCommand(+ document,+ { itemId: 'a2', layerId: 'r1' },+ { isEnabled: true, type: 'set-enabled' }+ );+ expect((toggled!.config as unknown as { adjustments: { isEnabled: boolean }[] }).adjustments[1]!.isEnabled).toBe(+ true+ );+ const removed = layerChildRowCommand(document, { itemId: 'a2', layerId: 'r1' }, { type: 'remove' });+ expect(+ (removed!.config as unknown as { adjustments: { id: string }[] }).adjustments.map((entry) => entry.id)+ ).toEqual(['a1', 'a3']);+ expect(+ layerChildRowCommand(document, { itemId: 'ref1', layerId: 'rg1' }, { direction: 1, type: 'move' })+ ).toBeNull();+ expect(+ layerChildRowCommand(document, { itemId: 'ref1', layerId: 'rg1' }, { newId: 'x', type: 'duplicate' })+ ).toBeNull();+ expect(getLayerChildItem(document, 'r1', 'a3')).toEqual({ isEnabled: true, kind: 'adjustment-curves' });+ });+});diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.tsindex 883d803c41..b6bf8968cd 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerChildRows.ts@@ -1,4 +1,5 @@import type {+ CanvasAdjustmentEntry,CanvasDocumentContractV3,CanvasInpaintMaskLayerContract,DocumentCommand,@@ -19,7 +20,25 @@ export { layerChildRowKey };* round-trips through the same `patch-config` seam the Properties pane uses.*/-export type LayerChildRowKind = 'reference-image' | 'mask-noise' | 'mask-denoise';+export type LayerChildRowKind =+ | 'reference-image'+ | 'mask-noise'+ | 'mask-denoise'+ | 'adjustment-brightness-contrast'+ | 'adjustment-hsl'+ | 'adjustment-curves';++/** The row kind projecting an adjustment entry of `type`. */+export const adjustmentChildKind = (type: CanvasAdjustmentEntry['type']): LayerChildRowKind => ADJUSTMENT_KIND_OF[type];++const ADJUSTMENT_KIND_OF: Record<CanvasAdjustmentEntry['type'], LayerChildRowKind> = {+ 'brightness-contrast': 'adjustment-brightness-contrast',+ curves: 'adjustment-curves',+ hsl: 'adjustment-hsl',+};++/** Kinds whose list order is document truth; their rows offer Move up/down and Duplicate. */+export const isOrderedChildKind = (kind: LayerChildRowKind): boolean => kind.startsWith('adjustment-');/** The synthetic item ids of a mask's singleton modifiers. */export const MASK_NOISE_ITEM_ID = 'noise';@@ -44,7 +63,11 @@ export interface ProjectedChildRow {readonly value: number | null;}-export type LayerChildRowAction = { type: 'set-enabled'; isEnabled: boolean } | { type: 'remove' };+export type LayerChildRowAction =+ | { type: 'set-enabled'; isEnabled: boolean }+ | { type: 'remove' }+ | { type: 'move'; direction: -1 | 1 }+ | { type: 'duplicate'; newId: string };/** A child row's live item facts, resolved from the document; `null` when it is gone. */export interface LayerChildItem {@@ -117,6 +140,19 @@ export const projectLayerChildRows = (vm: SemanticNode): readonly ProjectedChild}));} else if (node.type === 'inpaint_mask' && (node.noise || node.denoise)) {rows = maskModifierRows(vm, node);+ } else if (node.type === 'raster' && node.adjustments && node.adjustments.length > 0) {+ const setSize = node.adjustments.length;+ rows = node.adjustments.map((adjustment, index): ProjectedChildRow => ({+ ...baseRow(vm),+ image: null,+ isEnabled: adjustment.isEnabled,+ itemId: adjustment.id,+ key: layerChildRowKey(node.id, adjustment.id),+ kind: ADJUSTMENT_KIND_OF[adjustment.type],+ posInSet: index + 1,+ setSize,+ value: adjustment.type === 'hsl' ? adjustment.saturation : null,+ }));} else {return EMPTY_CHILD_ROWS;}@@ -143,6 +179,10 @@ export const getLayerChildItem = (return { isEnabled: layer.denoise.isEnabled, kind: 'mask-denoise' };}}+ if (layer?.type === 'raster') {+ const entry = layer.adjustments?.find((candidate) => candidate.id === itemId);+ return entry ? { isEnabled: entry.isEnabled, kind: ADJUSTMENT_KIND_OF[entry.type] } : null;+ }return null;};@@ -155,6 +195,10 @@ export const layerChildRemoveLabelKey = (kind: LayerChildRowKind): string => {return 'widgets.layers.modifiers.removeNoise';case 'mask-denoise':return 'widgets.layers.modifiers.removeDenoise';+ case 'adjustment-brightness-contrast':+ case 'adjustment-hsl':+ case 'adjustment-curves':+ return 'widgets.layers.modifiers.removeAdjustment';}};@@ -172,6 +216,9 @@ export const layerChildRowCommand = (): PatchConfigCommand | null => {const layer = getDocumentLayer(document, target.layerId);if (layer?.type === 'regional_guidance') {+ if (action.type === 'move' || action.type === 'duplicate') {+ return null;+ }if (!layer.referenceImages.some((ref) => ref.id === target.itemId)) {return null;}@@ -191,6 +238,9 @@ export const layerChildRowCommand = (};}if (layer?.type === 'inpaint_mask') {+ if (action.type === 'move' || action.type === 'duplicate') {+ return null;+ }const field =target.itemId === MASK_NOISE_ITEM_ID ? 'noise' : target.itemId === MASK_DENOISE_ITEM_ID ? 'denoise' : null;const current = field ? layer[field] : undefined;@@ -208,5 +258,50 @@ export const layerChildRowCommand = (type: 'patch-config',};}+ if (layer?.type === 'raster') {+ const before = layer.adjustments ?? [];+ const index = before.findIndex((entry) => entry.id === target.itemId);+ if (index < 0) {+ return null;+ }+ let next: CanvasAdjustmentEntry[];+ switch (action.type) {+ case 'set-enabled': {+ if (before[index]!.isEnabled === action.isEnabled) {+ return null;+ }+ next = before.map((entry, i) => (i === index ? { ...entry, isEnabled: action.isEnabled } : entry));+ break;+ }+ case 'remove':+ next = before.filter((_, i) => i !== index);+ break;+ case 'move': {+ const to = index + action.direction;+ if (to < 0 || to >= before.length) {+ return null;+ }+ next = [...before];+ [next[index], next[to]] = [next[to]!, next[index]!];+ break;+ }+ case 'duplicate': {+ const source = before[index]!;+ // The copy must not alias the source's nested curve arrays.+ const copy =+ source.type === 'curves'+ ? { ...source, curves: structuredClone(source.curves), id: action.newId }+ : { ...source, id: action.newId };+ next = [...before.slice(0, index + 1), copy, ...before.slice(index + 1)];+ break;+ }+ }+ return {+ before: { adjustments: [...before], layerType: 'raster' },+ config: { adjustments: next, layerType: 'raster' },+ id: target.layerId,+ type: 'patch-config',+ };+ }return null;};diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.test.tsindex 832a26efc3..1ede0bead6 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.test.ts@@ -89,6 +89,7 @@ const makeState = (};const makeEffects = (): LayerContextActionEffects => ({+ addAdjustment: vi.fn(),addMaskModifier: vi.fn(),addReferenceImage: vi.fn(),booleanMerge: vi.fn(() => Promise.resolve()),@@ -299,7 +300,7 @@ describe('layer context action registry', () => {const context = makeRuntimeContext(rasterLayer, { effects });getLayerContextActionDefinition('move-to-front').handler(context);- getLayerContextActionDefinition('adjustments').handler(context);+ getLayerContextActionDefinition('add-curves').handler(context);getLayerContextActionDefinition('filter').handler(context);getLayerContextActionDefinition('intersect').handler(context);getLayerContextActionDefinition('copy-to-control').handler(context);@@ -307,7 +308,7 @@ describe('layer context action registry', () => {getLayerContextActionDefinition('regional-auto-negative').handler(context);expect(effects.reorder).toHaveBeenCalledWith('front', 'move-to-front');- expect(effects.openProperties).toHaveBeenCalledWith();+ expect(effects.addAdjustment).toHaveBeenCalledWith('curves');expect(effects.startFilter).toHaveBeenCalledWith(rasterLayer.id);expect(effects.booleanMerge).toHaveBeenCalledWith('intersect');expect(effects.copyTo).toHaveBeenCalledWith('control');@@ -318,8 +319,8 @@ describe('layer context action registry', () => {describe('getLayerContextActions', () => {it.each([- ['raster', 'adjustments', true],- ['control', 'adjustments', false],+ ['raster', 'add-curves', true],+ ['control', 'add-curves', false],['inpaint_mask', 'extract-masked-area', true],['control', 'extract-masked-area', false],] as const)('resolves %s visibility for %s', (type, actionId, expected) => {@@ -454,7 +455,9 @@ describe('getLayerContextActions', () => {'rename','transform','fit-to-bbox',- 'adjustments',+ 'add-brightness-contrast',+ 'add-hsl',+ 'add-curves','save-to-assets','copy-to-clipboard','crop-to-bbox',@@ -533,7 +536,9 @@ describe('getLayerContextActions', () => {for (const id of ['fit-to-bbox',- 'adjustments',+ 'add-brightness-contrast',+ 'add-hsl',+ 'add-curves','filter','select-object','run-workflow',@@ -607,7 +612,9 @@ describe('getLayerContextActions', () => {'rename','transform','fit-to-bbox',- 'adjustments',+ 'add-brightness-contrast',+ 'add-hsl',+ 'add-curves','save-to-assets','copy-to-clipboard','crop-to-bbox',diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.tsindex d27296d1a9..16c89b0f82 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextActions.ts@@ -21,6 +21,7 @@ import {ArrowUpToLineIcon,CopyIcon,CropIcon,+ DropletIcon,EyeIcon,EyeOffIcon,FolderPlusIcon,@@ -33,6 +34,8 @@ import {PencilIcon,SaveIcon,ScanSearchIcon,+ SplineIcon,+ SunMediumIcon,WavesIcon,SlidersHorizontalIcon,Trash2Icon,@@ -45,6 +48,9 @@ export type LayerContextActionId =| 'add-reference-image'| 'add-noise'| 'add-denoise-limit'+ | 'add-brightness-contrast'+ | 'add-hsl'+ | 'add-curves'| 'merge-selected'| 'move-to-front'| 'move-forward'@@ -55,7 +61,6 @@ export type LayerContextActionId =| 'rename'| 'transform'| 'fit-to-bbox'- | 'adjustments'| 'save-to-assets'| 'copy-to-clipboard'| 'crop-to-bbox'@@ -86,7 +91,7 @@ export type LayerContextActionId =export type LayerType = CanvasLayerContract['type'];export type LayerContextMenuSectionId = 'quick' | 'primary' | 'operations' | 'output' | 'state' | 'danger';-export type LayerContextSubmenuId = 'arrange' | 'boolean' | 'copy-to' | 'convert-to';+export type LayerContextSubmenuId = 'arrange' | 'boolean' | 'copy-to' | 'convert-to' | 'add-adjustment';export interface LayerContextActionState {canRunWorkflow: boolean;@@ -133,6 +138,7 @@ export interface LayerContextActionEffects {patchConfig(kind: LayerConfigPatchKind): void;addReferenceImage(): void;addMaskModifier(field: 'noise' | 'denoise'): void;+ addAdjustment(type: 'brightness-contrast' | 'hsl' | 'curves'): void;mergeDown(): void;toggleVisibility(): void;toggleHidden(): void;@@ -407,15 +413,42 @@ export const LAYER_CONTEXT_ACTION_DEFINITIONS: readonly LayerContextActionDefinisupportedLayerTypes: ALL_LAYER_TYPES,},{- defaultLabel: 'Adjustments',- handler: ({ effects }) => effects.openProperties(),- icon: SlidersHorizontalIcon,- id: 'adjustments',- isEnabled: hasMutablePixels,+ defaultLabel: 'Brightness/Contrast',+ handler: ({ effects }) => effects.addAdjustment('brightness-contrast'),+ icon: SunMediumIcon,+ id: 'add-brightness-contrast',+ isEnabled: isLayerMutable,isVisible: alwaysVisible,- labelKey: 'widgets.layers.actions.adjustments',+ labelKey: 'widgets.layers.modifiers.brightnessContrast',order: 31,section: 'primary',+ submenu: 'add-adjustment',+ supportedLayerTypes: RASTER_ONLY,+ },+ {+ defaultLabel: 'Saturation',+ handler: ({ effects }) => effects.addAdjustment('hsl'),+ icon: DropletIcon,+ id: 'add-hsl',+ isEnabled: isLayerMutable,+ isVisible: alwaysVisible,+ labelKey: 'widgets.layers.adjustments.saturation',+ order: 31.2,+ section: 'primary',+ submenu: 'add-adjustment',+ supportedLayerTypes: RASTER_ONLY,+ },+ {+ defaultLabel: 'Curves',+ handler: ({ effects }) => effects.addAdjustment('curves'),+ icon: SplineIcon,+ id: 'add-curves',+ isEnabled: isLayerMutable,+ isVisible: alwaysVisible,+ labelKey: 'widgets.layers.adjustments.curves',+ order: 31.4,+ section: 'primary',+ submenu: 'add-adjustment',supportedLayerTypes: RASTER_ONLY,},{diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextMenuLayout.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextMenuLayout.test.tsindex 7efe477563..390b0dc825 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextMenuLayout.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerContextMenuLayout.test.ts@@ -83,7 +83,15 @@ describe('getLayerContextMenuLayout', () => {},{id: 'primary',- items: ['transform', 'rename', 'fit-to-bbox', 'adjustments', 'filter', 'select-object', 'run-workflow'],+ items: [+ 'transform',+ 'rename',+ 'fit-to-bbox',+ 'add-adjustment(add-brightness-contrast,add-hsl,add-curves)',+ 'filter',+ 'select-object',+ 'run-workflow',+ ],presentation: 'list',},{diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.tsindex 7ca73ae46e..5e692acd62 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerOps.ts@@ -248,6 +248,10 @@ export const createRegionalGuidanceFromImage = (export const createReferenceImageId = (): string =>`rgref-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;+/** Mints a fresh raster adjustment-entry id. */+export const createAdjustmentId = (): string =>+ `adj-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;+/*** A fresh regional reference image, minting the config kind the region's base can* actually consume: FLUX regions use FLUX Redux (the only kind resolved for FLUXdiff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowCommands.ts b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowCommands.tsindex 28e8e91e1b..e23ff1d743 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowCommands.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/layerRowCommands.ts@@ -39,6 +39,10 @@ export interface LayerRowCommands {selectChild(child: ProjectedChildRow, options?: { reveal?: boolean }): void;setChildEnabled(child: ProjectedChildRow, isEnabled: boolean): void;removeChild(child: ProjectedChildRow): void;+ /** Ordered kinds only (adjustment entries): swap with the neighbour in `direction`. */+ moveChild(child: ProjectedChildRow, direction: -1 | 1): void;+ /** Ordered kinds only: insert a copy directly after the entry. */+ duplicateChild(child: ProjectedChildRow): void;openChildMenu(child: ProjectedChildRow, anchor: LayerSurfaceAnchor): void;/** `id` is a node id, a child-row key, or a stack header key; the tree tells them apart. */keyDown(id: string, event: KeyboardEvent<HTMLElement>): void;diff --git a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerSection.tsx b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerSection.tsxindex 2e7c797019..32dc2799a0 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerSection.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/layers/panes/LayerSection.tsx@@ -5,10 +5,15 @@ import { Stack, Switch, Text } from '@chakra-ui/react';import { getDocumentLayer } from '@workbench/canvas-engine/api';import { useCanvasEngine } from '@workbench/widgets/canvas/useCanvasEngine';import { usePreparedCommit } from '@workbench/widgets/canvas/useStructuralCommit';-import { AdjustmentsPopover } from '@workbench/widgets/layers/AdjustmentsPopover';+import { AdjustmentSettings } from '@workbench/widgets/layers/AdjustmentSettings';import { ControlLayerSettings } from '@workbench/widgets/layers/ControlLayerSettings';import { InpaintMaskSettings } from '@workbench/widgets/layers/InpaintMaskSettings';-import { MASK_DENOISE_ITEM_ID, MASK_NOISE_ITEM_ID } from '@workbench/widgets/layers/layerChildRows';+import {+ adjustmentChildKind,+ MASK_DENOISE_ITEM_ID,+ MASK_NOISE_ITEM_ID,+ type LayerChildRowKind,+} from '@workbench/widgets/layers/layerChildRows';import { useLayerChildSelection } from '@workbench/widgets/layers/layerChildSelection';import { MaskModifierSettings } from '@workbench/widgets/layers/MaskModifierSettings';import { RasterLayerFilterSection } from '@workbench/widgets/layers/RasterLayerFilterSection';@@ -64,7 +69,7 @@ export const LayerSection = ({ disabled }: { disabled: boolean }) => {};interface ChildEditorTarget {- readonly kind: 'reference-image' | 'mask-noise' | 'mask-denoise';+ readonly kind: LayerChildRowKind;readonly itemId: string;readonly subtitle: string;}@@ -96,6 +101,18 @@ const resolveChildEditor = (return { itemId: selection.itemId, kind: 'mask-denoise', subtitle: t('widgets.layers.modifiers.denoise') };}}+ if (layer.type === 'raster') {+ const entry = layer.adjustments?.find((candidate) => candidate.id === selection.itemId);+ if (entry) {+ const subtitle =+ entry.type === 'brightness-contrast'+ ? t('widgets.layers.modifiers.brightnessContrast')+ : entry.type === 'hsl'+ ? t('widgets.layers.adjustments.saturation')+ : t('widgets.layers.adjustments.curves');+ return { itemId: selection.itemId, kind: adjustmentChildKind(entry.type), subtitle };+ }+ }return null;};@@ -114,6 +131,9 @@ const ChildEditor = ({if ((child.kind === 'mask-noise' || child.kind === 'mask-denoise') && layer.type === 'inpaint_mask') {return <MaskModifierSettings engine={engine} kind={child.kind} layer={layer} />;}+ if (child.kind.startsWith('adjustment-') && layer.type === 'raster') {+ return <AdjustmentSettings engine={engine} entryId={child.itemId} layer={layer} />;+ }return null;};@@ -186,10 +206,6 @@ const RasterLayerSettings = ({<Text fontSize="xs">{t('widgets.layers.adjustments.transparencyLock')}</Text></Switch.Label></Switch.Root>- <Text color="fg.muted" fontSize="2xs" fontWeight="700" textTransform="uppercase">- {t('widgets.layers.adjustments.title')}- </Text>- <AdjustmentsPopover engine={engine} layer={layer} /><RasterLayerFilterSection engine={engine} layer={layer} onOperationStarted={noop} /></Stack>);