X6 icon indicating copy to clipboard operation
X6 copied to clipboard

x6 2.x版本视口变换的方法zoomToFit不能支持把部分节点缩放到中心;原来1.x版本zoomToRect可以实现;2.x版本这个api找不到了

Open zhuqq1 opened this issue 1 year ago • 1 comments

问题描述

比如画布上有分散开的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]

屏幕截图或视频(可选)

企业微信截图_17247610323096

补充说明(可选)

No response

zhuqq1 avatar Aug 27 '24 12:08 zhuqq1

👋 @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.

x6-bot[bot] avatar Aug 27 '24 12:08 x6-bot[bot]

尝试了一下,使用 zoomToRect 并且配置 contentArea没有效果

q32757468 avatar Aug 15 '25 05:08 q32757468

提供一个思路:

  1. 使用 positionRect 来移动到你想要的区域
  2. 通过移动的区域与画布大小计算出 zoom 的值
  3. 使用zoom 来手动缩放一下

q32757468 avatar Aug 15 '25 06:08 q32757468

还有问题欢迎打开该issue再讨论~

q32757468 avatar Aug 15 '25 06:08 q32757468