diff options
Diffstat (limited to 'src/Utils.ts')
-rw-r--r-- | src/Utils.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index f352b87e3..948b6176e 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -10,4 +10,13 @@ export class Utils { public static GenerateDeterministicGuid(seed: string): string { return v5(seed, v5.URL); } + + public static GetScreenTransform(ele: HTMLElement): { scale: number, translateX: number, translateY: number } { + const rect = ele.getBoundingClientRect(); + const scale = rect.width / ele.offsetWidth; + const translateX = rect.left; + const translateY = rect.top; + + return { scale, translateX, translateY }; + } }
\ No newline at end of file |