Revert "[Cleanup] Remove unused hooks on DOMWidget" (#2543)

This commit is contained in:
Chenlei Hu
2025-02-12 20:57:38 -05:00
committed by GitHub
parent 89812ce7d0
commit f791322ddb

View File

@@ -67,6 +67,8 @@ export interface DOMWidgetOptions<
getMaxHeight?: () => number
getHeight?: () => string | number
onDraw?: (widget: DOMWidget<T, V>) => void
beforeResize?: (this: DOMWidget<T, V>, node: LGraphNode) => void
afterResize?: (this: DOMWidget<T, V>, node: LGraphNode) => void
}
function intersect(a: Rect, b: Rect): Vector4 | null {
@@ -488,8 +490,10 @@ LGraphNode.prototype.addDOMWidget = function <
this[SIZE] = true
const onResize = this.onResize
this.onResize = function (size: Size) {
options.beforeResize?.call(widget, this)
computeSize.call(this, size)
onResize?.call(this, size)
options.afterResize?.call(widget, this)
}
}