Sha256: 4cd2b76292c12e354a6576461e4dcf6b327a13954cb1e4afbc417338193dcdeb
Contents?: true
Size: 610 Bytes
Versions: 271
Compression:
Stored size: 610 Bytes
Contents
/* global color */ /** * Get coordinates for an element's client rects or bounding client rect * * @method centerPointOfRect * @memberof axe.commons.color * @param {DOMRect} rect * @returns {Object | undefined} */ color.centerPointOfRect = function centerPointOfRect(rect) { if (rect.left > window.innerWidth) { return undefined; } if (rect.top > window.innerHeight) { return undefined; } const x = Math.min( Math.ceil(rect.left + rect.width / 2), window.innerWidth - 1 ); const y = Math.min( Math.ceil(rect.top + rect.height / 2), window.innerHeight - 1 ); return { x, y }; };
Version data entries
271 entries across 271 versions & 1 rubygems