getAngle method

dynamic getAngle(
  1. dynamic p1,
  2. dynamic p2
)
  • Calculate the angle between two pointers
    • @param {PointerEvent} p1
      • @param {PointerEvent} p2
      • @returns {Number} The angle between two pointers in degrees

Implementation

getAngle(p1, p2) {
  return Math.atan2(p2.clientY - p1.clientY, p2.clientX - p1.clientX) *
      180 /
      Math.PI;
}