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

Function getPointClientRect

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

Source from the content-addressed store, hash-verified

1127}
1128
1129function getPointClientRect(point: EventPoint): Rect {
1130 let offsetX = 0;
1131 let offsetY = 0;
1132 if (point.width !== undefined) {
1133 offsetX = point.width / 2;
1134 } else if (point.radiusX !== undefined) {
1135 offsetX = point.radiusX;
1136 }
1137 if (point.height !== undefined) {
1138 offsetY = point.height / 2;
1139 } else if (point.radiusY !== undefined) {
1140 offsetY = point.radiusY;
1141 }
1142
1143 return {
1144 top: point.clientY - offsetY,
1145 right: point.clientX + offsetX,
1146 bottom: point.clientY + offsetY,
1147 left: point.clientX - offsetX
1148 };
1149}
1150
1151function areRectanglesOverlapping(a: Rect, b: Rect) {
1152 // check if they cannot overlap on x axis

Callers 1

isOverTargetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected