antvis/G6




The issue has been closed
To get REAL center in graph.zoom you need to use window.innerWidth and window.innerHeight NOT graph.getViewPortCenterPoint() #5091
Radomir-Drukh posted onGitHub
Describe the bug
To get REAL center in graph.zoom you need to use window.innerWidth and window.innerHeight NOT graph.getViewPortCenterPoint()
graph.zoom(1.2, graph.getViewPortCenterPoint()) - WRONG
This call will zoom with move with offset
graph.zoom(1.2, {x: window.innerWidth / 2, y: window.innerHeight / 2} ) - CORRECT
This call will zoom right at the center.
Please state this fact in the documentation
Your Example Website or App
-
Steps to Reproduce the Bug or Issue
1) Create graph that takes up only part of the screen 2) Call graph.zoom(1.2, graph.getViewPortCenterPoint())
Expected behavior
As a user, I expected that graph.zoom(1.2, graph.getViewPortCenterPoint()) will zoom at the center of the camera view but i am seeing strange offset
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
Additional context
No response