(title: string, type?: string)
| 681 | } |
| 682 | |
| 683 | constructor(title: string, type?: string) { |
| 684 | this.id = LiteGraph.use_uuids ? LiteGraph.uuidv4() : -1 |
| 685 | this.title = title || "Unnamed" |
| 686 | this.type = type ?? "" |
| 687 | this.size = [LiteGraph.NODE_WIDTH, 60] |
| 688 | this.pos = [10, 10] |
| 689 | this.strokeStyles = { |
| 690 | error: this.#getErrorStrokeStyle, |
| 691 | selected: this.#getSelectedStrokeStyle, |
| 692 | } |
| 693 | |
| 694 | // Assign onMouseDown implementation |
| 695 | this.onMouseDown = (e: CanvasPointerEvent, pos: Point, canvas: LGraphCanvas): boolean => { |
| 696 | // Check for title button clicks (only if not collapsed) |
| 697 | if (this.title_buttons?.length && !this.flags.collapsed) { |
| 698 | // pos contains the offset from the node's position, so we need to use node-relative coordinates |
| 699 | const nodeRelativeX = pos[0] |
| 700 | const nodeRelativeY = pos[1] |
| 701 | |
| 702 | for (let i = 0; i < this.title_buttons.length; i++) { |
| 703 | const button = this.title_buttons[i] |
| 704 | if (button.visible && button.isPointInside(nodeRelativeX, nodeRelativeY)) { |
| 705 | this.onTitleButtonClick(button, canvas) |
| 706 | return true // Prevent default behavior |
| 707 | } |
| 708 | } |
| 709 | } |
| 710 | |
| 711 | return false // Allow default behavior |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | /** Internal callback for subgraph nodes. Do not implement externally. */ |
| 716 | _internalConfigureAfterSlots?(): void |
nothing calls this directly
no test coverage detected