Protected_heightProtected_widthProtected_xProtected_yGets the Y position of the bottom edge.
Gets the X position of the left edge.
Gets the X position of the right edge.
Gets the Y position of the top edge.
Clips the point to the rectangle.
The point to clip.
StaticisStaticisStaticwith
The Rect2 implements a 2D rectangle with an origin in top left and a width and height. The class follows the 'copy-on-write' pattern, which means that every operation such as Rect2.inset or Rect2.outset returns a copy of the rect with updates values. It also implies that the values of the rect cannot be directly modified.
The concept of immutability improves sharing of objects as all types in TypeScript are assigned by identity, instead of by-value (e.g. a copy) as in other programming languages like C.