You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Application-Web/front/Utils.ts

10 lines
337 B

export function calculateRatio(it: { x: number, y: number }, parent: DOMRect): { x: number, y: number } {
const relativeXPixels = it.x - parent.x;
const relativeYPixels = it.y - parent.y;
const xRatio = relativeXPixels / parent.width;
const yRatio = relativeYPixels / parent.height;
return {x: xRatio, y: yRatio}
}