MCPcopy Create free account
hub / github.com/adobe/react-spectrum / getPointClientRect

Function getPointClientRect

packages/react-aria/src/interactions/usePress.ts:1108–1128  ·  view source on GitHub ↗
(point: EventPoint)

Source from the content-addressed store, hash-verified

1106}
1107
1108function 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
1130function areRectanglesOverlapping(a: Rect, b: Rect) {
1131 // check if they cannot overlap on x axis

Callers 1

isOverTargetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected