UNPKG

@studiometa/js-toolkit

Version:

A set of useful little bits of JavaScript to boost your project! 🚀

23 lines (22 loc) • 763 B
/** * @typedef {Object} Point * @property {number} x Point's x position * @property {number} y Point's y position */ /** * @typedef {Object} Rect * @property {number} x Rectangle's x position * @property {number} y Rectangle's y position * @property {number} width Rectangle's width * @property {number} height Rectangle's height */ /** * Test if a point collides with a rectangle. * Inspired by http://www.jeffreythompson.org/collision-detection/point-rect.php * * @param {Point} point Point * @param {Rect} rect Rectangle * @return {boolean} Is the point inside the rectangle's bounds ? * @link https://js-toolkit.studiometa.dev/utils/collision/collidePointRect.html */ export declare function collidePointRect(point: any, rect: any): boolean;