UNPKG

@studiometa/js-toolkit

Version:

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

22 lines (21 loc) • 684 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 * @returns {boolean} Is the point inside the rectangle's bounds ? */ export declare function collidePointRect(point: any, rect: any): boolean;