@aplus-frontend/ui
Version:
23 lines (22 loc) • 507 B
JavaScript
function o(t, e = 0, i = 100) {
return Math.max(e, Math.min(t, i));
}
function n(t, e) {
const i = e === "horizontal" ? "Left" : "Top", l = e === "horizontal" ? "Width" : "Height";
return {
totalSize: t[`scroll${l}`],
visibleSize: t[`offset${l}`],
distance: t[`scroll${i}`],
topOrLeft: i,
widthOrHeight: l
};
}
function r(t, e) {
const { totalSize: i, visibleSize: l } = n(t, e);
return i > l;
}
export {
o as ensureRangeValue,
n as getScrollable,
r as isScrollable
};