fix: 修正缩放容器内的画布输入坐标 - #2299
Open
Geequlim wants to merge 1 commit into
Open
Conversation
Member
|
结论:建议暂缓合并,标记 Request changes。发现两个坐标换算问题。 [P2] 混用了 border box 与 client box。 另外,PR #2299 目前只有构建和实际项目手工验证,没有自动化状态检查。建议补充以下回归场景:默认零高度容器、scale + translate、带边框容器,并分别覆盖鼠标和触摸输入。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动说明
修正 LayaAir canvas 放在被 CSS 缩放或偏移的容器中时,鼠标和触摸输入坐标可能偏移的问题。
此前
InputManager直接使用原生事件的页面/视口坐标,再进入现有的_canvasTransform流程。当 canvas 外层容器被移动或缩放时,例如开发工具内嵌预览面板,命中测试坐标会和实际显示位置不一致。
本次改动会先把原生
clientX/clientY换算到主画布父容器的本地坐标系,再继续沿用现有的_canvasTransform和clientScale处理流程。改动内容
clientX/clientYgetBoundingClientRect()换算输入坐标测试