mirror of
https://github.com/penpot/penpot.git
synced 2026-03-16 23:46:26 +00:00
12 lines
295 B
TypeScript
12 lines
295 B
TypeScript
export const parseTranslate = (el: HTMLElement | null) => {
|
|
let x = 0;
|
|
let y = 0;
|
|
if (el && window['DOMMatrixReadOnly']) {
|
|
const cs = window.getComputedStyle(el);
|
|
const matrix = new DOMMatrixReadOnly(cs.transform);
|
|
x = matrix.m41;
|
|
y = matrix.m42;
|
|
}
|
|
return { x, y };
|
|
};
|