@mankindui/core
Version:
- a react component library - you can see how @mankindui/core can be used via examples: [usage examples](https://github.com/clarklindev/mankindui-test)
29 lines (28 loc) • 1.24 kB
JavaScript
import { Position as r } from "./position.js";
var d = /* @__PURE__ */ ((t) => (t.TL = "top-left", t.BL = "bottom-left", t.TR = "top-right", t.BR = "bottom-right", t))(d || {});
const l = window.innerWidth, u = window.innerHeight, f = (t, e) => {
const n = t.getBoundingClientRect(), o = n.left + n.width / 2, i = Math.round(o);
if (e === void 0)
return i === Math.round(l) ? r.CENTER : o < l / 2 ? r.LEFT : r.RIGHT;
{
const s = e.getBoundingClientRect(), c = s.left + s.width / 2, g = Math.round(c);
if (console.log("roundedTriggerCenter: ", i), console.log("roundedLayoutContainerCenter: ", g), i === g)
console.log("CENTER");
else
return Math.round(o) < Math.round(c) ? (console.log("LEFT"), r.LEFT) : (console.log("RIGHT"), r.RIGHT);
}
return r.CENTER;
}, C = (t) => {
try {
const e = t.getBoundingClientRect(), n = e.left + e.width / 2, o = e.top + e.height / 2;
return n < l / 2 ? o < u / 2 ? "top-left" : "bottom-left" : o < u / 2 ? "top-right" : "bottom-right";
} catch (e) {
return console.error("Error: " + e.message), null;
}
};
export {
d as Quadrant,
f as getHorizontalQuadrant,
C as getQuadrantWithRespectToViewport
};
//# sourceMappingURL=getQuadrant.js.map