motion-plus-vue
Version:
Motion Plus Vue
18 lines (17 loc) • 558 B
JavaScript
import { computed as u } from "vue";
import { useSnappedValue as g } from "../hooks/use-snapped-value.mjs";
function v(e, a, o, n) {
const t = g(
u(() => e.value.x),
n,
u(() => o.value.targetBoundingBox ? o.value.targetBoundingBox.left + o.value.targetBoundingBox.width / 2 : void 0)
), i = g(
u(() => e.value.y),
n,
u(() => o.value.targetBoundingBox ? o.value.targetBoundingBox.top + o.value.targetBoundingBox.height / 2 : void 0)
);
return u(() => a.value ? { x: t, y: i } : e.value);
}
export {
v as useMagneticTarget
};