[Refactor] Add LGraphNode.title_mode (#439)

This commit is contained in:
Chenlei Hu
2025-02-03 10:57:14 -08:00
committed by GitHub
parent 00de6ae960
commit 3e133b71e6
2 changed files with 6 additions and 2 deletions

View File

@@ -5168,7 +5168,7 @@ export class LGraphCanvas {
const { collapsed } = node.flags
const shape = node._shape || node.constructor.shape || LiteGraph.NODE_DEFAULT_SHAPE
const { title_mode } = node.constructor
const title_mode = node.title_mode
const render_title = title_mode == TitleMode.TRANSPARENT_TITLE || title_mode == TitleMode.NO_TITLE
? false

View File

@@ -291,6 +291,10 @@ export class LGraphNode implements Positionable, IPinnable {
this.selected = value
}
public get title_mode(): TitleMode {
return this.constructor.title_mode ?? TitleMode.NORMAL_TITLE
}
// Used in group node
setInnerNodes?(this: LGraphNode, nodes: LGraphNode[]): void
@@ -1617,7 +1621,7 @@ export class LGraphNode implements Positionable, IPinnable {
* @param pad Expands the area by this amount on each side. Default: 0
*/
measure(out: Rect, pad = 0): void {
const titleMode = this.constructor.title_mode
const titleMode = this.title_mode
const renderTitle =
titleMode != TitleMode.TRANSPARENT_TITLE &&
titleMode != TitleMode.NO_TITLE