antvis/G6

Can not update 'visibility' from 'hidden' to 'visible' #6559

TZZack posted onGitHub

Describe the bug / 问题描述

new Graph时data里面某个节点数据设置visibility为hidden,后续通过graph.updateNodeData把该节点的visibility改为visible,不生效(另外一个节点opacity初始设置为0,后续修改为1能生效) 重现代码如下

import { Graph } from "@antv/g6";

const data = {
  nodes: [
    { id: "node1", style: { x: 250, y: 150, visibility: "hidden" } },
    { id: "node2", style: { x: 350, y: 150, opacity: 0 } },
    { id: "node3", style: { x: 250, y: 300 } },
  ],
  edges: [],
};

const graph = new Graph({
  container: "container",
  data,
  node: {
    style: {
      labelText: (d) => d.id,
    },
  },
  behaviors: ["drag-element", "collapse-expand"],
});

graph.render();

setTimeout(() => {
  graph.updateNodeData([
    {
      id: "node1",
      style: {
        visibility: "visible",
      },
    },
    {
      id: "node2",
      style: {
        opacity: 1,
      },
    },
  ]);
  graph.draw();
}, 2000);

https://codesandbox.io/p/sandbox/funny-zhukovsky-rjhzq3?file=%2Findex.js%3A1%2C1-42%2C1

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

按重现代码或重现链接跑,即可重现

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

Windows

Browser / 浏览器

Chrome

Additional context / 补充说明

No response


Fund this Issue

$0.00
Funded

Pull requests