diff options
author | bobzel <zzzman@gmail.com> | 2025-03-16 19:02:56 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2025-03-16 19:02:56 -0400 |
commit | df708c90d8356934d2e3d9123129c761d328c1fe (patch) | |
tree | 98b0588710ac8ca00c303960da0851614aacf597 /src/client/views/nodes/imageEditor/imageEditorUtils/PointerHandler.ts | |
parent | 7d9fae09e8906e5636f6ea695ad560797b08d023 (diff) | |
parent | f4042257be7359734a0dd35cedbf03fe4aa14cf1 (diff) |
Merge branch 'DocCreatorMenu-work' of https://github.com/brown-dash/Dash-Web into DocCreatorMenu-work
Diffstat (limited to 'src/client/views/nodes/imageEditor/imageEditorUtils/PointerHandler.ts')
-rw-r--r-- | src/client/views/nodes/imageEditor/imageEditorUtils/PointerHandler.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/client/views/nodes/imageEditor/imageEditorUtils/PointerHandler.ts b/src/client/views/nodes/imageEditor/imageEditorUtils/PointerHandler.ts new file mode 100644 index 000000000..e86f46636 --- /dev/null +++ b/src/client/views/nodes/imageEditor/imageEditorUtils/PointerHandler.ts @@ -0,0 +1,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, + }; + }; +} |