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

Class Point

packages/react-stately/src/virtualizer/Point.ts:13–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11 */
12
13export class Point {
14 /** The x-coordinate of the point. */
15 x: number;
16
17 /** The y-coordinate of the point. */
18 y: number;
19
20 constructor(x = 0, y = 0) {
21 this.x = x;
22 this.y = y;
23 }
24
25 /**
26 * Returns a copy of this point.
27 */
28 copy(): Point {
29 return new Point(this.x, this.y);
30 }
31
32 /**
33 * Checks if two points are equal.
34 */
35 equals(point: Point): boolean {
36 return this.x === point.x && this.y === point.y;
37 }
38
39 /**
40 * Returns true if this point is the origin.
41 */
42 isOrigin(): boolean {
43 return this.x === 0 && this.y === 0;
44 }
45}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected