Skip to content

Commit 3bfb894

Browse files
fix: Adjust shader canvas drawing order to render on top of the node's title gradient.
1 parent 0d31532 commit 3bfb894

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "comfyui-shadernoiseksampler-web",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"type": "module",
55
"description": "TypeScript frontend for ComfyUI ShaderNoiseKSampler custom nodes",
66
"scripts": {

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "comfyui-shadernoiseksampler"
33
description = "Transform AI image generation from random exploration into deliberate artistic navigation. This advanced KSampler replacement blends traditional noise with shader noise. Navigate latent space with intention using adjustable noise parameters, shape masks, and colors transformations."
4-
version = "1.3.2"
4+
version = "1.3.3"
55
license = {file = "LICENSE"}
66

77
[project.urls]

web/shader_renderer.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/src/shader_renderer.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,8 @@ const FRAGMENT_SHADER_FOOTER = `
15231523
nodeType.prototype.onDrawForeground = function (this: ShaderRendererNode, ctx: CanvasRenderingContext2D) {
15241524
if (this.properties?.shaderVisible && this.shaderCanvas && !this.flags?.collapsed) {
15251525
this.isShaderActive = true;
1526+
// Call origOnDrawForeground FIRST so gradient title acts as background
1527+
if (origOnDrawForeground) origOnDrawForeground.call(this, ctx);
15261528
// Render shader synchronously before drawing to ensure fresh content
15271529
this.renderShader();
15281530
if (!this.animationFrameId) {
@@ -1536,8 +1538,8 @@ const FRAGMENT_SHADER_FOOTER = `
15361538
const baseSize = origComputeSize ? origComputeSize.call(this, [this.size[0], 0]) : [this.size[0], 0];
15371539
const shaderY = baseSize[1];
15381540
const shaderHeight = Math.max(50, this.size[1] - shaderY);
1541+
// Draw shader canvas AFTER origOnDrawForeground so it renders on top of the gradient
15391542
try { ctx.drawImage(this.shaderCanvas, 0, shaderY, this.size[0], shaderHeight); } catch (e) { /* ignore */ }
1540-
if (origOnDrawForeground) origOnDrawForeground.call(this, ctx);
15411543
} else {
15421544
if (origOnDrawForeground) origOnDrawForeground.call(this, ctx);
15431545
this.isShaderActive = false;

0 commit comments

Comments
 (0)