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

ios和安卓中POINTER_MOVE事件stageY坐标不一致问题 #161

Open
SHEE94 opened this issue Mar 26, 2020 · 3 comments
Open

ios和安卓中POINTER_MOVE事件stageY坐标不一致问题 #161

SHEE94 opened this issue Mar 26, 2020 · 3 comments

Comments

@SHEE94
Copy link

SHEE94 commented Mar 26, 2020

当滑动的距离越远stageY坐标偏移越大,到顶部大概坐标还差300左右,但手指都已近在屏幕外力,在安卓上没有出现这个问题

@SHEE94 SHEE94 changed the title ios和安卓中POINTER_MOVE事件stageY坐标一致问题 ios和安卓中POINTER_MOVE事件stageY坐标不一致问题 Mar 26, 2020
@SHEE94
Copy link
Author

SHEE94 commented Mar 26, 2020

目前找到了一个解决办法官方中e.stageY似乎是e.touches[0].clientY坐标乘以2倍,但有做了自己的一套计算方法,最简单的办法就是直接使用e.touches[0].clientY坐标乘以2倍来计算,可以解决ios诗stageY坐标偏移问题

@06wj
Copy link
Member

06wj commented Mar 26, 2020

stageX和stageY是在stage坐标系下的,距顶部你应该拿stage.width和stage.height来做对比。
ios和android不同应该是你设置了stage的scale不同吧

@SHEE94
Copy link
Author

SHEE94 commented Mar 26, 2020

是只在在stage上监听 的POINTER_MOVE事件,scale安卓和苹果是一致的,理论上只要我的手指直接在stage上滑动,那坐标stageY和stageX坐标是和我的手指一致的,但stageY坐标没有跟随我的手指,而且距离屏幕越远的位置向上移动,到顶部的误差越大```
this.stage.on(Hilo.event.POINTER_MOVE, function (e) {
e.stopImmediatePropagation && e.stopImmediatePropagation();
console.log('hilo',e.stageY)
}.bind(this))

这个事件中是直接获取,手指已经滑倒屏幕之外,但stageY的值却没有到0

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

2 participants