From 844866b489003365809aed6cd57999e92e8c0214 Mon Sep 17 00:00:00 2001 From: "alexei.dolgolyov" Date: Fri, 13 Mar 2026 17:49:34 +0300 Subject: [PATCH] Zoom to newly added entity in graph editor instead of just panning Co-Authored-By: Claude Opus 4.6 --- .../wled_controller/static/js/features/graph-editor.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/src/wled_controller/static/js/features/graph-editor.js b/server/src/wled_controller/static/js/features/graph-editor.js index da2791c..7ea72a0 100644 --- a/server/src/wled_controller/static/js/features/graph-editor.js +++ b/server/src/wled_controller/static/js/features/graph-editor.js @@ -280,10 +280,16 @@ function _watchForNewEntity() { if (!Array.isArray(data)) return; for (const item of data) { if (item.id && !knownIds.has(item.id)) { - // Found a new entity — reload graph and navigate to it + // Found a new entity — reload graph and zoom to it const newId = item.id; cleanup(); - loadGraphEditor().then(() => _navigateToNode(newId)); + loadGraphEditor().then(() => { + const node = _nodeMap?.get(newId); + if (node && _canvas) { + _canvas.zoomToPoint(1.5, node.x + node.width / 2, node.y + node.height / 2); + } + _navigateToNode(newId); + }); return; } }