Attach DOM widgets to canvas container instead of document body (#364)

This commit is contained in:
Chenlei Hu
2024-08-10 18:38:56 -04:00
committed by GitHub
parent 7ce7490bc3
commit 23fcdd3e44

View File

@@ -264,7 +264,7 @@ LGraphNode.prototype.addDOMWidget = function (
options = { hideOnZoom: true, selectOn: ['focus', 'click'], ...options }
if (!element.parentElement) {
document.body.append(element)
app.canvasContainer.append(element)
}
element.hidden = true
element.style.display = 'none'
@@ -335,8 +335,8 @@ LGraphNode.prototype.addDOMWidget = function (
Object.assign(element.style, {
transformOrigin: '0 0',
transform: scale,
left: `${transform.a + transform.e + elRect.left}px`,
top: `${transform.d + transform.f + elRect.top}px`,
left: `${transform.a + transform.e}px`,
top: `${transform.d + transform.f}px`,
width: `${widgetWidth - margin * 2}px`,
height: `${(widget.computedHeight ?? 50) - margin * 2}px`,
position: 'absolute',