Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

Test: the paint editor's flat layout in a browser

Gabriele Lozupone036fad51f572
diff --git a/src/lib/useZoomPan.test.tsx b/src/lib/useZoomPan.test.tsx
index 3e8aa23..36fae8c 100644
--- a/src/lib/useZoomPan.test.tsx
+++ b/src/lib/useZoomPan.test.tsx
@@ -755,8 +755,15 @@ describe("InpaintEditor & ZoomPan Integration", () => {
expect(viewport).not.toBeNull();
const maskWrap = container.querySelector(".mask-wrap") as HTMLElement;
expect(maskWrap).not.toBeNull();
- expect(maskWrap.style.width).toBe("1600px");
- expect(maskWrap.style.height).toBe("900px");
+ // A browser draws it flat (ZoomPan `flat`): the content box has the image's shape at its
+ // drawn size and the mask box fills it; the mask keeps the image's own resolution.
+ const content = container.querySelector(".inpaint-zoom-viewport .zoom-pan-content") as HTMLElement;
+ expect(parseFloat(content.style.width) / parseFloat(content.style.height)).toBeCloseTo(1600 / 900, 5);
+ expect(content.style.transform).not.toContain("scale");
+ expect(maskWrap.style.width).toBe("100%");
+ expect(maskWrap.style.height).toBe("100%");
+ const canvas = maskWrap.querySelector("canvas") as HTMLCanvasElement;
+ expect([canvas.width, canvas.height]).toEqual([1600, 900]);
});
it("toggles pan mode via Spacebar hold and Hand tool button", () => {