Files
comfyui_o1key/web/js/dotGrid.js
T
JonyandClaude Opus 4.6 69279c654d feat: 新增 Grok 图像节点、前端 UI 增强、重构 nano-banana 系列
- 新增 Grok Image 节点及客户端
- 新增 save_image_format 节点
- 新增前端 JS 扩展:画笔工具、点阵网格、侧边栏隐藏、资源切换、重命名等
- 重构 nano-banana 节点,移除 pro 版本
- 移除 multi_res_preview 节点
- 新增 http_error 工具模块
- 各客户端和节点优化改进

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-05-24 22:46:55 +08:00

42 lines
1.4 KiB
JavaScript

import { app } from "../../../scripts/app.js";
app.registerExtension({
name: "o1key.dotGrid",
async setup() {
function createBlackTile() {
const size = 64;
const c = document.createElement("canvas");
c.width = size;
c.height = size;
const ctx = c.getContext("2d");
ctx.fillStyle = "#1a1a1a";
ctx.fillRect(0, 0, size, size);
return c;
}
// Hook immediately so the first draw already uses our tile
const orig = LGraphCanvas.prototype.drawBackCanvas;
LGraphCanvas.prototype.drawBackCanvas = function () {
if (!this._pattern || !this._pattern_img) {
const ctx = this.bgcanvas?.getContext("2d");
if (ctx) {
const t = createBlackTile();
this._pattern = ctx.createPattern(t, "repeat");
this._pattern_img = t;
}
}
return orig.apply(this, arguments);
};
// Also apply to current canvas instance if already exists
const canvas = app.canvas;
if (canvas?.bgcanvas) {
const bgCtx = canvas.bgcanvas.getContext("2d");
const tile = createBlackTile();
canvas._pattern = bgCtx.createPattern(tile, "repeat");
canvas._pattern_img = tile;
canvas.draw(true, true);
}
},
});