MCPcopy Index your code
hub / github.com/phaserjs/phaser / GetRectangleIntersection

Function GetRectangleIntersection

src/geom/intersects/GetRectangleIntersection.js:28–41  ·  view source on GitHub ↗
(rectA, rectB, output)

Source from the content-addressed store, hash-verified

26 * @return {Phaser.Geom.Rectangle} A rectangle object with intersection data.
27 */
28var GetRectangleIntersection = function (rectA, rectB, output)
29{
30 if (output === undefined) { output = new Rectangle(); }
31
32 if (RectangleToRectangle(rectA, rectB))
33 {
34 output.x = Math.max(rectA.x, rectB.x);
35 output.y = Math.max(rectA.y, rectB.y);
36 output.width = Math.min(rectA.right, rectB.right) - output.x;
37 output.height = Math.min(rectA.bottom, rectB.bottom) - output.y;
38 }
39
40 return output;
41};
42
43module.exports = GetRectangleIntersection;

Calls 1

RectangleToRectangleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…