motion-plus-vue
Version:
Motion Plus Vue
40 lines (39 loc) • 982 B
JavaScript
function h(o, n, i) {
const t = {
width: (i == null ? void 0 : i.width) ?? o,
height: (i == null ? void 0 : i.height) ?? n
};
return typeof t.width == "number" && (t.width = `${t.width}px`), typeof t.height == "number" && (t.height = `${t.height}px`), t;
}
function c({
type: o,
state: n,
hasChildren: i,
style: t,
isMagnetic: r,
magneticOptions: e,
matchTextSize: u
}) {
const E = r && n.targetBoundingBox;
if (i && !E)
return h("auto", "auto", t);
const { padding: T, morph: g } = e;
switch (o) {
case "pointer":
if (r && g && n.targetBoundingBox) {
const { width: d, height: I } = n.targetBoundingBox;
return {
width: `${d + T * 2}px`,
height: `${I + T * 2}px`
};
}
return h(31, 31, t);
case "text":
return u && n.fontSize ? { width: "4px", height: `${n.fontSize}px` } : h(4, 20, t);
default:
return h(17, 17, t);
}
}
export {
c as getCursorSize
};