UNPKG

p5

Version:

[![npm version](https://badge.fury.io/js/p5.svg)](https://www.npmjs.com/package/p5)

43 lines (42 loc) • 724 B
import "../constants-DA50zLWL.js"; //#region src/core/helpers.js /** */ function modeAdjust(a, b, c, d, mode) { let bbox; if (mode === "corner") bbox = { x: a, y: b, w: Math.abs(c), h: Math.abs(d) }; else if (mode === "corners") bbox = { x: Math.min(a, c), y: Math.min(b, d), w: Math.abs(c - a), h: Math.abs(d - b) }; else if (mode === "radius") { c = Math.abs(c); d = Math.abs(d); bbox = { x: a - c, y: b - d, w: 2 * c, h: 2 * d }; } else if (mode === "center") { c = Math.abs(c); d = Math.abs(d); bbox = { x: a - c * .5, y: b - d * .5, w: c, h: d }; } return bbox; } var helpers_default = { modeAdjust }; //#endregion export { helpers_default as default };