MCPcopy
hub / github.com/pixijs/pixijs / containsRect

Method containsRect

src/maths/shapes/Rectangle.ts:795–808  ·  view source on GitHub ↗

* Determines whether another Rectangle is fully contained within this Rectangle. * * Rectangles that occupy the same space are considered to be containing each other. * * Rectangles without area (width or height equal to zero) can't contain anything, * not even other areales

(other: Rectangle)

Source from the content-addressed store, hash-verified

793 * @see {@link Rectangle.intersects} For overlap testing
794 */
795 public containsRect(other: Rectangle): boolean
796 {
797 if (this.width <= 0 || this.height <= 0) return false;
798
799 const x1 = other.x;
800 const y1 = other.y;
801 const x2 = other.x + other.width;
802 const y2 = other.y + other.height;
803
804 return x1 >= this.x && x1 < this.x + this.width
805 && y1 >= this.y && y1 < this.y + this.height
806 && x2 >= this.x && x2 < this.x + this.width
807 && y2 >= this.y && y2 < this.y + this.height;
808 }
809
810 /**
811 * Sets the position and dimensions of the rectangle.

Callers 3

Rectangle.test.tsFile · 0.80
containsPolygonMethod · 0.80
Rectangle.test.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected