1 先记录 屏幕上 的手指数量 (记录方法 按下+1 松开-1)
2 记录每个手指的在屏幕上的坐标 每个手指的touchid不一样 用数组存就行 shouzhis[touchid]= x,y
3 如果屏幕上有2个手指
1 缩放按照2个手指的距离来计算
private getTouchDistance():number { var _distance:number = 0; var names = this.touchPoints["names"]; _distance = egret.Point.distance( this.touchPoints[names[names.length-1]], this.touchPoints[names[names.length-2]]); return _distance; }
2 旋转 是按照2个手指的角度来计算
private getTouchAngle():number { var ang:number = 0; var names = this.touchPoints["names"]; var p1:egret.Point = this.touchPoints[names[names.length-1]]; var p2:egret.Point = this.touchPoints[names[names.length-2]]; ang = Math.atan2((p1.y-p2.y),(p1.x-p2.x)) / this.c; return ang; }
原文地址:https://www.cnblogs.com/newmiracle/p/12350677.html
时间: 2024-10-11 01:27:55