| 1106 | } |
| 1107 | |
| 1108 | function getPointClientRect(point: EventPoint): Rect { |
| 1109 | let offsetX = 0; |
| 1110 | let offsetY = 0; |
| 1111 | if (point.width !== undefined) { |
| 1112 | offsetX = point.width / 2; |
| 1113 | } else if (point.radiusX !== undefined) { |
| 1114 | offsetX = point.radiusX; |
| 1115 | } |
| 1116 | if (point.height !== undefined) { |
| 1117 | offsetY = point.height / 2; |
| 1118 | } else if (point.radiusY !== undefined) { |
| 1119 | offsetY = point.radiusY; |
| 1120 | } |
| 1121 | |
| 1122 | return { |
| 1123 | top: point.clientY - offsetY, |
| 1124 | right: point.clientX + offsetX, |
| 1125 | bottom: point.clientY + offsetY, |
| 1126 | left: point.clientX - offsetX |
| 1127 | }; |
| 1128 | } |
| 1129 | |
| 1130 | function areRectanglesOverlapping(a: Rect, b: Rect) { |
| 1131 | // check if they cannot overlap on x axis |