@realsee/dnalogel
Version:
13 lines (12 loc) • 300 B
JavaScript
import * as s from "three";
const { Vector2: f } = s;
function r(t, e) {
const { offsetWidth: o, offsetHeight: n } = e, { top: c, left: i } = e.getBoundingClientRect();
return Object.assign(new f(), {
x: (t.x - i) / o * 2 - 1,
y: -(t.y - c) / n * 2 + 1
});
}
export {
r as default
};