* Proper node width/height calculation

* 0.7.71
This commit is contained in:
Chenlei Hu
2024-09-12 17:00:13 +09:00
committed by GitHub
parent 7dbe6400bb
commit 0f1b72ce94
4 changed files with 9 additions and 5 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@comfyorg/litegraph",
"version": "0.7.70",
"version": "0.7.71",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@comfyorg/litegraph",
"version": "0.7.70",
"version": "0.7.71",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.12",

View File

@@ -1,6 +1,6 @@
{
"name": "@comfyorg/litegraph",
"version": "0.7.70",
"version": "0.7.71",
"type": "module",
"description": "A graph node editor similar to PD or UDK Blueprints. It works in an HTML5 Canvas and allows to export graphs to be included in applications.",
"main": "./dist/litegraph.umd.js",

View File

@@ -1126,6 +1126,10 @@ export declare class LGraphNode {
/** Called by `LGraphCanvas.processContextMenu` */
getMenuOptions?(graphCanvas: LGraphCanvas): ContextMenuItem[];
getSlotMenuOptions?(slot: INodeSlot): ContextMenuItem[];
get width(): number;
get height(): number;
drawBadges?(ctx: CanvasRenderingContext2D, options: { gap?: number }): void;
}
export type LGraphNodeConstructor<T extends LGraphNode = LGraphNode> = {

View File

@@ -4820,11 +4820,11 @@ const globalExport = {};
}
get width() {
return this.size[0];
return this.collapsed ? this._collapsed_width || LiteGraph.NODE_COLLAPSED_WIDTH : this.size[0];
}
get height() {
return this.size[1];
return this.collapsed ? LiteGraph.NODE_COLLAPSED_HEIGHT : this.size[1];
}
drawBadges(ctx, {gap = 2} = {}) {