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

Class Size

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

Source from the content-addressed store, hash-verified

11 */
12
13export class Size {
14 width: number;
15 height: number;
16
17 constructor(width = 0, height = 0) {
18 this.width = Math.max(width, 0);
19 this.height = Math.max(height, 0);
20 }
21
22 /**
23 * Returns a copy of this size.
24 */
25 copy(): Size {
26 return new Size(this.width, this.height);
27 }
28
29 /**
30 * Returns whether this size is equal to another one.
31 */
32 equals(other: Size): boolean {
33 return this.width === other.width && this.height === other.height;
34 }
35
36 /**
37 * The total area of the Size.
38 */
39 get area(): number {
40 return this.width * this.height;
41 }
42}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected