Skip to content

Commit db37693

Browse files
authored
Remove accidental onMouseDown handler (#5405)
* Remove accidental onMouseDown handler * Fix test snapshot * Add test that onMouseDown isn't overwritten
1 parent c2eb4f0 commit db37693

File tree

3 files changed

+5
-32
lines changed

3 files changed

+5
-32
lines changed

src/lib/litegraph/src/LGraphNode.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -743,35 +743,6 @@ export class LGraphNode
743743
error: this.#getErrorStrokeStyle,
744744
selected: this.#getSelectedStrokeStyle
745745
}
746-
747-
// Assign onMouseDown implementation
748-
this.onMouseDown = (
749-
// @ts-expect-error - CanvasPointerEvent type needs fixing
750-
e: CanvasPointerEvent,
751-
pos: Point,
752-
canvas: LGraphCanvas
753-
): boolean => {
754-
// Check for title button clicks (only if not collapsed)
755-
if (this.title_buttons?.length && !this.flags.collapsed) {
756-
// pos contains the offset from the node's position, so we need to use node-relative coordinates
757-
const nodeRelativeX = pos[0]
758-
const nodeRelativeY = pos[1]
759-
760-
for (let i = 0; i < this.title_buttons.length; i++) {
761-
const button = this.title_buttons[i]
762-
if (
763-
button.visible &&
764-
button.isPointInside(nodeRelativeX, nodeRelativeY)
765-
) {
766-
this.onTitleButtonClick(button, canvas)
767-
return true // Prevent default behavior
768-
}
769-
}
770-
}
771-
772-
return false // Allow default behavior
773-
}
774-
775746
// Initialize property manager with tracked properties
776747
this.changeTracker = new LGraphNodeProperties(this)
777748
}

tests-ui/tests/litegraph/core/LGraphNode.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,5 +621,10 @@ describe('LGraphNode', () => {
621621
expect(node.getInputSlotPos(inputSlot)).toEqual([expectedX, expectedY])
622622
delete (node.constructor as any).slot_start_y
623623
})
624+
test('should not overwrite onMouseDown prototype', () => {
625+
expect(Object.prototype.hasOwnProperty.call(node, 'onMouseDown')).toEqual(
626+
false
627+
)
628+
})
624629
})
625630
})

tests-ui/tests/litegraph/core/__snapshots__/LGraph.test.ts.snap

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ LGraph {
8484
"lostFocusAt": undefined,
8585
"mode": 0,
8686
"mouseOver": undefined,
87-
"onMouseDown": [Function],
8887
"order": 0,
8988
"outputs": [],
9089
"progress": undefined,
@@ -157,7 +156,6 @@ LGraph {
157156
"lostFocusAt": undefined,
158157
"mode": 0,
159158
"mouseOver": undefined,
160-
"onMouseDown": [Function],
161159
"order": 0,
162160
"outputs": [],
163161
"progress": undefined,
@@ -231,7 +229,6 @@ LGraph {
231229
"lostFocusAt": undefined,
232230
"mode": 0,
233231
"mouseOver": undefined,
234-
"onMouseDown": [Function],
235232
"order": 0,
236233
"outputs": [],
237234
"progress": undefined,

0 commit comments

Comments
 (0)