Compare commits

...

3 Commits

Author SHA1 Message Date
Christian Byrne
4f47534cb0 Merge branch 'main' into perf/fix-dom-widgets 2026-03-26 21:36:55 -07:00
github-actions
f76e39aa34 [automated] Update test expectations 2026-03-16 06:15:59 +00:00
bymyself
ed2cd0fa35 fix: avoid per-frame reactive mutations in DomWidgets positioning
Amp-Thread-ID: https://ampcode.com/threads/T-019cbb69-3404-726a-8888-182193115b88
2026-03-15 22:15:49 -07:00
23 changed files with 40 additions and 15 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -83,16 +83,30 @@ const updateWidgets = () => {
if (widgetState.visible) {
const margin = widget.margin
widgetState.pos = [
posNode.pos[0] + margin,
posNode.pos[1] + margin + posWidget.y
]
widgetState.size = [
(posWidget.width ?? posNode.width) - margin * 2,
(posWidget.computedHeight ?? 50) - margin * 2
]
widgetState.zIndex = getDomWidgetZIndex(posNode, currentGraph)
widgetState.readonly = lgCanvas.read_only
const newPosX = posNode.pos[0] + margin
const newPosY = posNode.pos[1] + margin + posWidget.y
if (widgetState.pos[0] !== newPosX || widgetState.pos[1] !== newPosY) {
widgetState.pos = [newPosX, newPosY]
}
const newWidth = (posWidget.width ?? posNode.width) - margin * 2
const newHeight = (posWidget.computedHeight ?? 50) - margin * 2
if (
widgetState.size[0] !== newWidth ||
widgetState.size[1] !== newHeight
) {
widgetState.size = [newWidth, newHeight]
}
const newZIndex = getDomWidgetZIndex(posNode, currentGraph)
if (widgetState.zIndex !== newZIndex) {
widgetState.zIndex = newZIndex
}
const newReadonly = lgCanvas.read_only
if (widgetState.readonly !== newReadonly) {
widgetState.readonly = newReadonly
}
}
}

View File

@@ -118,16 +118,27 @@ function composeStyle() {
}
}
watch([() => widgetState.pos, () => widgetState.size, left, top], () => {
updatePosition(widgetState)
if (enableDomClipping.value) {
updateDomClipping()
}
composeStyle()
})
watch(
[() => widgetState, left, top, enableDomClipping],
([widgetState]) => {
updatePosition(widgetState)
[
() => widgetState.zIndex,
() => widgetState.readonly,
() => widgetState.positionOverride,
enableDomClipping
],
() => {
if (enableDomClipping.value) {
updateDomClipping()
}
composeStyle()
},
{ deep: true }
}
)
// Recompose style when clippingStyle updates asynchronously via RAF.