Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/tui/src/utils/mod.ts>rectangleIntersection

🦕 Deno module for creating Terminal User Interfaces
Latest
function rectangleIntersection
import { rectangleIntersection } from "https://deno.land/x/tui@2.1.11/src/utils/mod.ts";

Calculate intersection between two rectangles

When data is set to true it returns:

  • collision rectangle when they collide
  • false when they don't

Otherwise it simply returns boolean whether they collide

Don't hold onto intersection object reference that gets returned!

It gets reused to save CPU usage and minimize GC.

Parameters

a: Rectangle
b: Rectangle
optional
data: false

Returns

boolean

Parameters

a: Rectangle
b: Rectangle
data: true

Returns

false | Rectangle