/**
* @function pointInBounds
* @summary
* Use this function to test if a point is with a bounds object
*
* @param {Object} options
* @param {Object} options.pt the point to be tested
* @param {number} options.pt.x x coordinate
* @param {number} options.pt.y y coordinate
* @param {Object} options.bounds the bounds
* @param {number} options.bounds.left bounds left
* @param {number} options.bounds.right bounds right
* @param {number} options.bounds.top bounds top
* @param {number} options.bounds.bottom bounds bottom
* @returns boolean
*/
function pointInBounds (options) {
if (!(typeof options === 'object') || !options.pt || !options.bounds ||
(typeof options.pt.x !== 'number') || (typeof options.pt.y !== 'number')) {
var msg = 'pointInBounds must be called with options.pt and options.bounds'
console.error(msg)
return false
}
var pt = options.pt
var bounds = options.bounds
if ((pt.x >= bounds.left) && (pt.x <= bounds.right) && (pt.y >= bounds.top) && (pt.y <= bounds.bottom)) {
return true
}
return false
}
window.$b = window.$b || {}
window.$b.snippets = window.$b.snippets || {}
var snippets = window.$b.snippets
snippets.pointInBounds = pointInBounds
if (window.module) {
window.module.exports = pointInBounds
}