antvis/G6

v4.7.9 使用focusItem方法移动节点至视口中心,节点水平位置始终偏右 #5941

nancyzhan posted onGitHub

Describe the bug / 问题描述

focusItem方法未在水平位置上将矩形节点移动至中心,竖直位置可以。似乎在图中节点数较多时,水平位置会偏中心一些,但只有一个节点时完全靠右偏移至移出视口中心了 ` const animateCfg = { duration: 200, easing: 'easeCubic' }

const moveGraph = (searchNode) => { const node = appGraph.findById(searchNode); appGraph.focusItem(node, true, animateCfg) } ` Uploading show.png…

No response

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

G6 Version / G6 版本

4.x

Operating System / 操作系统

Windows

Browser / 浏览器

Chrome

Additional context / 补充说明


+1,但是如果animate:true或者开启了webworker又是正常的。v4最新版

posted by kevinmatr 10 months ago

尝试出了一个解决方案是在afteranimate之后再进行focus的操作: graph.on("afteranimate", (e: any) => { focusItem(node, true, animateCfg) });

posted by kevinmatr 10 months ago

Fund this Issue

$0.00
Funded

Pull requests