antvis/G6

G6节点x,y坐标读取错误 #5492

zuimenggucheng posted onGitHub

问题描述

<img width="810" alt="image" src="https://github.com/antvis/G6/assets/43475070/a7726485-ef75-4633-9225-f4347a3895de"> image 如截图所示,使用G6绘制自定义节点且为树状图展示时,为了方便拖拽父元素子元素随之更新位置进行移动,此处使用方法获取子元素model和父元素model。但是遇到问题打印出来的model里面的x,y值和model.x,model.y输出值不一致。 后续在生成graph.data(data)中的data数据的nodes数据时增加x,y默认值此现象消失

重现链接

https://g6.antv.vision/zh/examples/net/dagreFlow/#basicDagre

重现步骤

1.绘制流程图 https://g6.antv.vision/zh/examples/net/dagreFlow/#basicDagre 2.采用自定义节点 3.graph.data(data)其中data的nodes数据设置时不设置x,y 4.graph.findById获取对应节点 5.获取上述节点的model。 nodes.getModel() 同时打印 6.打印nodesModel.x,nodesModel.y数据不一致

预期行为

未设置x,y时数据读取展示也能一至

平台

  • 操作系统: [ Windows11]
  • 网页浏览器: [ Chrome,]
  • G6 版本: [4.8.7]

屏幕截图或视频(可选)

<img width="810" alt="image" src="https://github.com/antvis/G6/assets/43475070/a7726485-ef75-4633-9225-f4347a3895de"> image

补充说明(可选)

业务需求,树形显示组织架构并且支持拖拽进行更新组织架构


posted by zuimenggucheng about 1 year ago

请问解决了嘛?我也获取不到正确的坐标,这个获取到的看起来像中间变化的坐标 <img width="708" alt="image" src="https://github.com/antvis/G6/assets/101858811/63ffba8d-a1cf-4948-9143-38faca4cbf1d">

posted by AFufuaa about 1 year ago

解决了,在初始化节点的时候增加默认的x,y即可值可以是0

---原始邮件--- 发件人: @.*> 发送时间: 2024年3月20日(周三) 下午5:02 收件人: *@.>; 抄送: @.**@.>; 主题: Re: [antvis/G6] G6节点x,y坐标读取错误 (Issue #5492)

请问解决了嘛?我也获取不到正确的坐标

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

posted by zuimenggucheng about 1 year ago

Fund this Issue

$0.00
Funded

Pull requests