[bugfix] Prevent toolbar remount animation when clicking textarea widgets

When clicking on a textarea DOM widget, it was triggering a selection
update even if the node was already selected. This caused the toolbar
to unnecessarily re-animate.

The fix checks if the node is already selected before calling selectNode,
preventing redundant selection updates while maintaining proper selection
behavior for unselected nodes.

Fixes #4953

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
huchenlei
2025-08-12 21:44:01 -04:00
parent eba0b42674
commit 1c5bdd100c

View File

@@ -140,8 +140,13 @@ const setupDOMEventListeners = () => {
for (const evt of widget.options.selectOn ?? ['focus', 'click']) {
useEventListener(widget.element, evt, () => {
const lgCanvas = canvasStore.canvas
lgCanvas?.selectNode(widget.node)
lgCanvas?.bringToFront(widget.node)
if (!lgCanvas) return
const node = widget.node
if (!node.is_selected) {
lgCanvas.selectItems([node])
}
lgCanvas.bringToFront(node)
})
}
}