Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
32 lines
994 B
Plaintext
32 lines
994 B
Plaintext
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 axisEquals(a, b) {
|
|
return a.min === b.min && a.max === b.max;
|
|
}
|
|
function boxEquals(a, b) {
|
|
return axisEquals(a.x, b.x) && axisEquals(a.y, b.y);
|
|
}
|
|
function axisEqualsRounded(a, b) {
|
|
return (Math.round(a.min) === Math.round(b.min) &&
|
|
Math.round(a.max) === Math.round(b.max));
|
|
}
|
|
function boxEqualsRounded(a, b) {
|
|
return axisEqualsRounded(a.x, b.x) && axisEqualsRounded(a.y, b.y);
|
|
}
|
|
function aspectRatio(box) {
|
|
return calcLength(box.x) / calcLength(box.y);
|
|
}
|
|
function axisDeltaEquals(a, b) {
|
|
return (a.translate === b.translate &&
|
|
a.scale === b.scale &&
|
|
a.originPoint === b.originPoint);
|
|
}
|
|
|
|
export { aspectRatio, axisDeltaEquals, axisEquals, axisEqualsRounded, boxEquals, boxEqualsRounded, isDeltaZero };
|