diff --git a/src/lib/litegraph/src/LGraphNode.ts b/src/lib/litegraph/src/LGraphNode.ts index a68f2a82df..e28fca23f9 100644 --- a/src/lib/litegraph/src/LGraphNode.ts +++ b/src/lib/litegraph/src/LGraphNode.ts @@ -743,35 +743,6 @@ export class LGraphNode error: this.#getErrorStrokeStyle, selected: this.#getSelectedStrokeStyle } - - // Assign onMouseDown implementation - this.onMouseDown = ( - // @ts-expect-error - CanvasPointerEvent type needs fixing - e: CanvasPointerEvent, - pos: Point, - canvas: LGraphCanvas - ): boolean => { - // Check for title button clicks (only if not collapsed) - if (this.title_buttons?.length && !this.flags.collapsed) { - // pos contains the offset from the node's position, so we need to use node-relative coordinates - const nodeRelativeX = pos[0] - const nodeRelativeY = pos[1] - - for (let i = 0; i < this.title_buttons.length; i++) { - const button = this.title_buttons[i] - if ( - button.visible && - button.isPointInside(nodeRelativeX, nodeRelativeY) - ) { - this.onTitleButtonClick(button, canvas) - return true // Prevent default behavior - } - } - } - - return false // Allow default behavior - } - // Initialize property manager with tracked properties this.changeTracker = new LGraphNodeProperties(this) } diff --git a/tests-ui/tests/litegraph/core/LGraphNode.test.ts b/tests-ui/tests/litegraph/core/LGraphNode.test.ts index 1d47df5d8f..3eb38215f3 100644 --- a/tests-ui/tests/litegraph/core/LGraphNode.test.ts +++ b/tests-ui/tests/litegraph/core/LGraphNode.test.ts @@ -621,5 +621,10 @@ describe('LGraphNode', () => { expect(node.getInputSlotPos(inputSlot)).toEqual([expectedX, expectedY]) delete (node.constructor as any).slot_start_y }) + test('should not overwrite onMouseDown prototype', () => { + expect(Object.prototype.hasOwnProperty.call(node, 'onMouseDown')).toEqual( + false + ) + }) }) }) diff --git a/tests-ui/tests/litegraph/core/__snapshots__/LGraph.test.ts.snap b/tests-ui/tests/litegraph/core/__snapshots__/LGraph.test.ts.snap index d3e6de7b2e..1ce83fb465 100644 --- a/tests-ui/tests/litegraph/core/__snapshots__/LGraph.test.ts.snap +++ b/tests-ui/tests/litegraph/core/__snapshots__/LGraph.test.ts.snap @@ -84,7 +84,6 @@ LGraph { "lostFocusAt": undefined, "mode": 0, "mouseOver": undefined, - "onMouseDown": [Function], "order": 0, "outputs": [], "progress": undefined, @@ -157,7 +156,6 @@ LGraph { "lostFocusAt": undefined, "mode": 0, "mouseOver": undefined, - "onMouseDown": [Function], "order": 0, "outputs": [], "progress": undefined, @@ -231,7 +229,6 @@ LGraph { "lostFocusAt": undefined, "mode": 0, "mouseOver": undefined, - "onMouseDown": [Function], "order": 0, "outputs": [], "progress": undefined,