x6 2.x版本视口变换的方法zoomToFit不能支持把部分节点缩放到中心;原来1.x版本zoomToRect可以实现;2.x版本这个api找不到了
问题描述
比如画布上有分散开的10个节点;我想把相邻的3个节点缩放到视口中心;找不到对应的api; zoomToFit方法不能实现;原1.x版本中的zoomToRect可以实现;2.x版本这个api找不到了
我实现思路是先获取这3个节点的BBox 使用这个方法getCellsBBox(cells)得到数据; 然后想用zoomToFit方法把这个参数传入但是没有成功; 1.x版本的zoomToRect方法可以;2.x版本找不到这个方法;是不支持了吗;还是没有放出来;我看源码可以调用
重现链接
无
重现步骤
无
预期行为
无
平台
- 操作系统: [macOS, Windows, Linux, React Native ...]
- 网页浏览器: [Google Chrome, Safari, Firefox ...]
- X6 版本: [2.18.1]
屏幕截图或视频(可选)
补充说明(可选)
No response
👋 @zhuqq1
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. To help make it easier for us to investigate your issue, please follow the contributing guidelines. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
尝试了一下,使用 zoomToRect 并且配置 contentArea没有效果
提供一个思路:
- 使用
positionRect来移动到你想要的区域 - 通过移动的区域与画布大小计算出 zoom 的值
- 使用
zoom来手动缩放一下
还有问题欢迎打开该issue再讨论~