antvis/G6

The issue has been closed
【v5】根据节点的画布坐标,获取画布上节点的浏览器坐标数值不对 #5959
Nancy2013 posted onGitHub
Describe the bug / 问题描述
【实现】 // 通过id获取节点位置 const position = graph.getElementPosition(id); 返回结果:[-108, -48, 0]
// 将节点位置,转换为浏览器坐标 const clientPosition = graph.getClientByCanvas(position); 返回结果:[-108.00000762939453, -47.999996185302734]
【问题】 1、getElementPosition获取的节点位置,是视口坐标还是画布坐标; 2、获取的节点位置,转换为浏览器坐标数值不对; 3、如何获取节点的视口位置,并转换为浏览器坐标;
G6 Version / G6 版本
🆕 5.x
Operating System / 操作系统
Windows
Browser / 浏览器
Chrome