Skip to content
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

BUG:utils.js getOffset 方法调整。节点拖到画布边缘或外面之后,右键以及节点移动初始位置判定偏离,未考虑滚动条因素(即使滚动条不显示) #71

Open
qq379673328 opened this issue Mar 29, 2022 · 2 comments

Comments

@qq379673328
Copy link

调整如下:增加滚动条位置因素

export function getOffset(evt, target = null) {
const {
clientX,
clientY,
currentTarget
} = evt

const current = target || currentTarget
const scrollTop = current.scrollTop
const scrollLeft = current.scrollLeft
const {
left,
top
} = current.getBoundingClientRect()

return [clientX - left + scrollLeft, clientY - top + scrollTop]
}

@caohuatao
Copy link
Owner

是存在这个问题,初始设计的时候默认节点外层容器不存在滚动情况。会在后续版本中完善。

@youaremysuncat
Copy link

求大神指点 画布用transform 缩放后鼠标操作位置产生偏移

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants