We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
!!!https://antv-issue-helper.surge.sh 无法提交issue。
重现demo:https://g.antv.antgroup.com/zh/examples/camera/camera-action#zoom-by-point 重现步骤:随意拖拽画布。就会出现漂移的情况。
The text was updated successfully, but these errors were encountered:
漂移指的是什么意思?
如果是灵敏度太高的话,可以调整参数:
hammer.on('pan', (ev) => { camera.pan( (-ev.deltaX / Math.pow(2, camera.getZoom())) * 0.5, (-ev.deltaY / Math.pow(2, camera.getZoom())) * 0.5, ); });
将上述代码的 0.5 调整为更小即可。
0.5
Sorry, something went wrong.
2024-12-12.13.52.45.mov
没理解错的话,你的问题可能是想实现跟随手势均速平移。
对于 hammer 提供的事件对象来说,deltaX 和 deltaY 参数似乎代表的是自从首次触发事件时位置以来的绝对偏移量,而 G 相机 API 的 pan() 需要的参数是相对偏移量,你可以通过在每次触发事件时记录上一次的绝对偏移量,通过计算差值得到相对偏移量,然后调用 pan() 来实现你期望的交互效果。
deltaX
deltaY
pan()
你可以直接使用 g-plugin-control 插件,或者参考其实现:https://github.com/antvis/G/blob/next/packages/g-plugin-control/src/ControlPlugin.ts#L66
g-plugin-control
关于插件的使用方式请查看该文档:https://g.antv.antgroup.com/plugins/intro
No branches or pull requests
!!!https://antv-issue-helper.surge.sh 无法提交issue。
重现demo:https://g.antv.antgroup.com/zh/examples/camera/camera-action#zoom-by-point
重现步骤:随意拖拽画布。就会出现漂移的情况。
The text was updated successfully, but these errors were encountered: