blob: e86f466365dfbbeee32e883acfdd2b6b476c85bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
import { Point } from './imageEditorInterfaces';
export class PointerHandler {
static getPointRelativeToElement = (element: HTMLElement, e: React.PointerEvent | PointerEvent, scale: number): Point => {
const boundingBox = element.getBoundingClientRect();
return {
x: (e.clientX - boundingBox.x) / scale,
y: (e.clientY - boundingBox.y) / scale,
};
};
}
|