Skip to content

Commit 23fcdd3

Browse files
authored
Attach DOM widgets to canvas container instead of document body (#364)
1 parent 7ce7490 commit 23fcdd3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/scripts/domWidget.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ LGraphNode.prototype.addDOMWidget = function (
264264
options = { hideOnZoom: true, selectOn: ['focus', 'click'], ...options }
265265

266266
if (!element.parentElement) {
267-
document.body.append(element)
267+
app.canvasContainer.append(element)
268268
}
269269
element.hidden = true
270270
element.style.display = 'none'
@@ -335,8 +335,8 @@ LGraphNode.prototype.addDOMWidget = function (
335335
Object.assign(element.style, {
336336
transformOrigin: '0 0',
337337
transform: scale,
338-
left: `${transform.a + transform.e + elRect.left}px`,
339-
top: `${transform.d + transform.f + elRect.top}px`,
338+
left: `${transform.a + transform.e}px`,
339+
top: `${transform.d + transform.f}px`,
340340
width: `${widgetWidth - margin * 2}px`,
341341
height: `${(widget.computedHeight ?? 50) - margin * 2}px`,
342342
position: 'absolute',

0 commit comments

Comments
 (0)