filepond
Version:
FilePond, where files go to stretch their bits.
72 lines (71 loc) • 1.63 kB
JavaScript
/*!
* FilePond v5.0.2
* Copyright (c) 2017-2026 Pqina B.V.
* Released under the MIT License
* https://filepond.com
*/
import { vectorCreate as g } from "./vector.js";
function n(t = 0, h = 0, e = 0, i = 0) {
return {
x: t,
y: h,
width: e,
height: i
};
}
function l(t) {
return {
x: t.left,
y: t.top,
width: t.right - t.left,
height: t.bottom - t.top
};
}
function m(t, h) {
return t.x === h.x && t.y === h.y && t.width === h.width && t.height === h.height;
}
function c(t) {
return g(t.x + t.width * 0.5, t.y + t.height * 0.5);
}
function d(t, h) {
const e = t.x, i = t.x + t.width, r = t.y, o = t.y + t.height, u = h.x, f = h.x + h.width, x = h.y, y = h.y + h.height;
return !(e > f || u > i || r > y || x > o);
}
function C(t, h) {
return !(h.x < t.x || h.y < t.y || h.x > t.x + t.width || h.y > t.y + t.height);
}
function B(t, h, e) {
return e = e ?? c(t), {
x: h * (t.x - e.x) + e.x,
y: h * (t.y - e.y) + e.y,
width: h * t.width,
height: h * t.height
};
}
function F(t, h) {
return {
x: t.x - h,
y: t.y - h,
width: t.width + h * 2,
height: t.height + h * 2
};
}
function L(t, h = t.width / t.height) {
let { width: e } = t, i = e / h;
return i > t.height && (i = t.height, e = i * h), n((t.width - e) * 0.5, (t.height - i) * 0.5, e, i);
}
function P(t, h) {
return n(h(t.x), h(t.y), h(t.width), h(t.height));
}
export {
P as rectApply,
c as rectCenter,
C as rectContainsPoint,
n as rectCreate,
m as rectEqual,
l as rectFromBounds,
L as rectFromSize,
d as rectIntersectWithRect,
F as rectPad,
B as rectScale
};