Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

feat(canvas): let the loupe's center box be the picker's target

Josh Corbettb257b7e3c264
diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayRenderer.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayRenderer.ts
index a458bd5d4e..e4db7bf119 100644
--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayRenderer.ts
+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/render/overlayRenderer.ts
@@ -258,7 +258,7 @@ const strokeOutlined = (ctx: Ctx, light: string, lightWidth: number): void => {
/**
* Draws the picker's loupe: the pixels around the pointer magnified without smoothing inside a ring, the sampled
- * center pixel boxed under the crosshair cursor, and its RGB values below.
+ * center pixel boxed as the target (the picker hides the system cursor), and its RGB values below.
*/
const drawColorLoupe = (ctx: Ctx, state: OverlayState): void => {
const loupe = state.colorLoupe;
diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/tools/colorPickerTool.test.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/tools/colorPickerTool.test.ts
index cd1572e29c..c8233afdb0 100644
--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/tools/colorPickerTool.test.ts
+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/tools/colorPickerTool.test.ts
@@ -248,9 +248,9 @@ describe('color picker tool', () => {
expect(h.loupes.at(-1)).toBe(false);
});
- it('reports a crosshair cursor', () => {
+ it("hides the system cursor so the loupe's boxed center pixel is the target", () => {
const tool = createColorPickerTool();
- expect(tool.cursor?.({} as ToolContext)).toBe('crosshair');
+ expect(tool.cursor?.({} as ToolContext)).toBe('none');
});
describe('one-shot color sample requests', () => {
diff --git a/invokeai/frontend/webv2/src/workbench/canvas-engine/tools/colorPickerTool.ts b/invokeai/frontend/webv2/src/workbench/canvas-engine/tools/colorPickerTool.ts
index 5e6837db60..87e601f281 100644
--- a/invokeai/frontend/webv2/src/workbench/canvas-engine/tools/colorPickerTool.ts
+++ b/invokeai/frontend/webv2/src/workbench/canvas-engine/tools/colorPickerTool.ts
@@ -48,7 +48,8 @@ export const createColorPickerTool = (): Tool => {
pickColorAt(ctx, sampler, input);
};
return {
- cursor: () => 'crosshair',
+ // The loupe's boxed center pixel is the target; a system cursor would cover it.
+ cursor: () => 'none',
id: 'colorPicker',
// A pointer already over the canvas (an Alt hold, a pick request) gets the loupe without moving.
onActivate: (ctx) => updateLoupe(ctx),