litegraph.js icon indicating copy to clipboard operation
litegraph.js copied to clipboard

Wrong and missing definitions for custom node appearance

Open altarfinch opened this issue 5 years ago • 0 comments

@sha-N, I noticed some wrong definitions:

    onDrawBackground?(
        canvas: HTMLCanvasElement,
        ctx: CanvasRenderingContext2D
    ): void;
    onDrawForeground?(
        canvas: HTMLCanvasElement,
        ctx: CanvasRenderingContext2D
    ): void;

I believe the arguments are swapped, it should be:

    onDrawBackground?(
        ctx: CanvasRenderingContext2D,
        canvas: HTMLCanvasElement
    ): void;
    onDrawForeground?(
        ctx: CanvasRenderingContext2D,
        canvas: HTMLCanvasElement
    ): void;

Also, if one wants to reproduce the custom node appearance sample in TS, the definition for LGraphNode.flags.collapsed is missing.

altarfinch avatar May 06 '20 01:05 altarfinch