antvis/G6

How to center a specified node in the view #6540

liaoluying posted onGitHub

Describe the bug / 问题描述

想让一个指定的节点在在视图居中,使用updateNodeData更新x,y,fill都不生效。布局使用的是force WX20241120-205550@2x

No response

Steps to Reproduce the Bug or Issue / 重现步骤

No response

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

macOS

Browser / 浏览器

Chrome

Additional context / 补充说明

No response


开启布局后,节点位置会优先考虑布局结果而不是用户输入

有两种方式来解决:

  1. 设置布局参数 nodeFilter?: (node: NodeData) => boolean; 来决定参与该布局的节点
  2. 数据中设置 node.data.fx/fy 来固定节点位置
posted by yvonneyx 5 months ago

也可以使用 focusElement API

posted by Aarebecca 5 months ago

Fund this Issue

$0.00
Funded

Pull requests