G6
G6 copied to clipboard
[Bug]: zoomBy origin only works when animation is turned off
Describe the bug / 问题描述
Calling zoomBy with origin set will only work if animation is off.
Reproduction link / 复现链接
https://codesandbox.io/p/devbox/vite-react-forked-qryx9c
Steps to Reproduce the Bug or Issue / 重现步骤
Call graph.zoomBy with animation on, and an origin.
e.g.
const graph = new Graph({
animation: { duration: 300 } // set something here
...
});
graph.zoomBy(1.1, undefined, [100, 100]);
or
graph.zoomBy(1.1, { duration: 300 }, [100, 100]);
The origin parameter is ignored. If you then turn animations off, e.g. with graph.zoomBy(1.1, false, [100, 100]), the origin will be respected.
Version / 版本
🆕 5.x
OS / 操作系统
- [x] macOS
- [ ] Windows
- [ ] Linux
- [ ] Others / 其他
Browser / 浏览器
- [ ] Chrome
- [ ] Edge
- [x] Firefox
- [ ] Safari (Limited support / 有限支持)
- [ ] IE (Nonsupport / 不支持)
- [ ] Others / 其他
https://github.com/antvis/G6/blob/282d0b2bc235fb7e11a0750da847d695c2590935/packages/g6/src/runtime/viewport.ts#L169-L180 It looks like origin wasn’t assigned here