Files
penpot/plugins/libs/plugins-runtime/src/lib/parse-translate.ts
Andrey Antukh ec1af4ad96 🎉 Import penpot-plugins repository
As commit 819a549e4928d2b1fa98e52bee82d59aec0f70d8
2025-12-30 14:56:15 +01:00

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 };
};