motion-plus-vue
Version:
Motion Plus Vue
32 lines (31 loc) • 721 B
JavaScript
import { wrap as p } from "motion-v";
import { findCurrentIndexFromInset as x } from "./find-current-index.mjs";
function v(t, e, f, d, r) {
if (e.length === 0)
return 0;
const s = e[e.length - 1].end + f, I = d ?? t - (r ?? 0);
let a = x(
t,
e,
s
), l = t, o = !1;
for (; !o; ) {
const { start: m, end: c } = e[p(0, e.length, a)], h = c - m, u = Math.floor(a / e.length) * s, n = m + u;
I <= n + f || n >= t ? (l = n, a--) : I <= n ? (l = n, o = !0) : ((r && h > r || l === t && I >= n) && (l = n), o = !0);
}
return l;
}
function C(t, e, f, d) {
const r = t - e;
return v(
t,
f,
d,
r,
e
);
}
export {
v as findPrevItemInset,
C as findPrevPageInset
};