From f791322ddbd531da5b7096f6fbb59a3459de813a Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Wed, 12 Feb 2025 20:57:38 -0500 Subject: [PATCH] Revert "[Cleanup] Remove unused hooks on DOMWidget" (#2543) --- src/scripts/domWidget.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/scripts/domWidget.ts b/src/scripts/domWidget.ts index 499eab348..8bb3e11bf 100644 --- a/src/scripts/domWidget.ts +++ b/src/scripts/domWidget.ts @@ -67,6 +67,8 @@ export interface DOMWidgetOptions< getMaxHeight?: () => number getHeight?: () => string | number onDraw?: (widget: DOMWidget) => void + beforeResize?: (this: DOMWidget, node: LGraphNode) => void + afterResize?: (this: DOMWidget, 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) } }