feat(canvas): adjust side panel element selection to center without exceeding 100% zoom

This commit is contained in:
HouYunFei
2026-08-06 11:46:28 +08:00
parent feb582bba8
commit a10f16d983
4 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -867,7 +867,7 @@ function InfiniteCanvasPage() {
if (!node) return;
const worldX = node.position.x + node.width / 2;
const worldY = node.position.y + node.height / 2;
const k = Math.min(Math.max(Math.min((size.width * 0.6) / node.width, (size.height * 0.6) / node.height), 0.05), 1.5);
const k = Math.min(Math.max(Math.min((size.width * 0.6) / node.width, (size.height * 0.6) / node.height), 0.05), 1);
const target = { x: size.width / 2 - worldX * k, y: size.height / 2 - worldY * k, k };
setSelectedNodeIds(new Set([nodeId]));
setSelectedConnectionId(null);