[]请问如何获取触屏上两个或者更多位置的坐标
我已经看过用两个手指旋转的demo 现在想问 能否可以在两个手指都按下去且不动的情况下 还能不断获取坐标
demo必须触发事件才能获取坐标 但是如果我一直按着不动就无法触发了
mouseXmouseY只能获取一个点的坐标
demo必须触发事件才能获取坐标 但是如果我一直按着不动就无法触发了
mouseXmouseY只能获取一个点的坐标
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
wudi199553
赞同来自:
var touches: Array<any> = e.touches;
if (touches && touches.length == 2) {
this.preRadian = Math.atan2(
touches[0].stageY - touches[1].stageY,
touches[0].stageX - touches[1].stageX);
Laya.stage.on(Event.MOUSE_MOVE, this, this.onMouseMove);
}
}
private onMouseMove(e: Event): void {
var touches: Array<any> = e.touches;
if (touches && touches.length == 2)
{
var nowRadian: number = Math.atan2(
touches[0].stageY - touches[1].stageY,
touches[0].stageX - touches[1].stageX);
this.sp.rotation += 180 / Math.PI * (nowRadian - this.preRadian);
length==2就是两根手指, 把他改成你想要的数量不久可以了么,他不是根据mousex,y;而是根据 touches[0].stageY - touches[1].stageY,