- 判断目标点是否在view范围内
fun View.pointInView(points: FloatArray): Boolean {
points[0] = points[0] - this.left
points[1] = points[1] - this.top
val matrix = this.matrix
if (!matrix.isIdentity) {
matrix.invert(matrix)
matrix.mapPoints(points)
}
return points[0] >= 0 && points[1] >= 0 && points[0] < this.width && points[1] < this.height
}