securityos/node_modules/framer-motion/dist/es/projection/geometry/utils.mjs

26 lines
798 B
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
import { calcLength } from './delta-calc.mjs';
function isAxisDeltaZero(delta) {
return delta.translate === 0 && delta.scale === 1;
}
function isDeltaZero(delta) {
return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);
}
function boxEquals(a, b) {
return (a.x.min === b.x.min &&
a.x.max === b.x.max &&
a.y.min === b.y.min &&
a.y.max === b.y.max);
}
function boxEqualsRounded(a, b) {
return (Math.round(a.x.min) === Math.round(b.x.min) &&
Math.round(a.x.max) === Math.round(b.x.max) &&
Math.round(a.y.min) === Math.round(b.y.min) &&
Math.round(a.y.max) === Math.round(b.y.max));
}
function aspectRatio(box) {
return calcLength(box.x) / calcLength(box.y);
}
export { aspectRatio, boxEquals, boxEqualsRounded, isDeltaZero };