@studiometa/js-toolkit
Version:
A set of useful little bits of JavaScript to boost your project! 🚀
15 lines (14 loc) • 379 B
JavaScript
function boundingRectToCircle({ x, y, width, height }, force = false) {
if (width !== height && !force) {
throw new Error("Initial DOMElement is not a square. Please use the force mode.");
}
return {
x: x + width / 2,
y: y + height / 2,
radius: (width + height) / 4
};
}
export {
boundingRectToCircle
};
//# sourceMappingURL=boundingRectToCircle.js.map