Improve click regions for widget interaction (#5253)

This commit is contained in:
AustinMroz
2025-09-03 12:44:13 -07:00
committed by GitHub
parent c74c1c014f
commit c4bb8a1435

View File

@@ -2136,10 +2136,22 @@ export class LGraphNode
widget.computeSize?.(nodeWidth)[1] ??
LiteGraph.NODE_WIDGET_HEIGHT
const maybeDOMWidget = widget as { margin?: number }
const mtop = maybeDOMWidget.margin ?? -2
const mbot = maybeDOMWidget.margin ?? 2
const mx = maybeDOMWidget.margin ?? 6
const w = widget.width || nodeWidth
if (
widget.last_y !== undefined &&
isInRectangle(x, y, 6, widget.last_y, w - 12, h)
isInRectangle(
x,
y,
mx,
widget.last_y + mtop,
w - 2 * mx,
h - mtop - mbot
)
) {
return widget
}