-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
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
leafer画布缩放后hover事件对元素的位置感应有偏差 #329
Comments
感谢反馈,需要给出能复现的代码和步骤,我这边测试不出来~ |
从官网提供的本地playground运行这段代码即可复现 const leafer = new Leafer({ view: window }) const rect = new Rect({ leafer.add(rect) const div = document.getElementsByTagName('div')[0] |
这样是会有问题,监听不到resize事件,需要手动更新一下 leafer.updateClientBounds(): https://www.leaferjs.com/ui/reference/display/Leafer.html#updateclientbounds 还有就是leafer提供了视口缩放功能,为什么不直接使用呢?是不是有什么特殊业务逻辑? |
感谢解答 |
你好,采用了第一种解决办法还是会出现相同的问题 leafer.updateClientBounds() |
外面再套一个div, 把这个transform设置在最外层试试 |
试过了,还是没有效果 const parentDiv = document.createElement("div"); const childrenDiv = document.createElement("div"); const leafer = new Leafer({ view: 'wrapper' }) const rect = new Rect({ leafer.add(rect) parentDiv.style.transform = |
我到时看下原因,可以用 leafer.scale = 0.6 来代替,然后parentDiv的宽高再处理一下 |
好的,有空的时候帮忙看看 |
leafer画布缩放后hover事件对元素的位置感应有偏差
The text was updated successfully, but these errors were encountered: