Skip to content

Commit

Permalink
Attach DOM widgets to canvas container instead of document body
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Aug 10, 2024
1 parent 7ce7490 commit 94f2c54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/scripts/domWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 94f2c54

Please sign in to comment.