Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function screenToUvCoordinates(
screenX: number,
screenY: number,
box: Math2D.Box,
uvBox: Math2D.UvBox
): { u: number; v: number } {
const minX = box.x;
const maxX = box.x + box.w;
const minY = box.y;
const maxY = box.y + box.h;
const u = MathUtils.map(screenX, minX, maxX, uvBox.s0, uvBox.s1);
const v = MathUtils.map(screenY, minY, maxY, uvBox.t0, uvBox.t1);
return { u, v };
}
export function screenToUvCoordinates(
screenX: number,
screenY: number,
box: Math2D.Box,
uvBox: Math2D.UvBox
): { u: number; v: number } {
const minX = box.x;
const maxX = box.x + box.w;
const minY = box.y;
const maxY = box.y + box.h;
const u = MathUtils.map(screenX, minX, maxX, uvBox.s0, uvBox.s1);
const v = MathUtils.map(screenY, minY, maxY, uvBox.t0, uvBox.t1);
return { u, v };
}