How to use the @moveable/matrix.convertCSStoMatrix function in @moveable/matrix

To help you get started, we’ve selected a few @moveable/matrix examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github daybrush / moveable / packages / react-moveable / src / react-moveable / utils.ts View on Github external
let transformOrigin!: number[];
    let targetMatrix!: number[];

    const offsetContainer = getOffsetInfo(container, container, true).offsetParent;

    if (prevMatrix) {
        container = target.parentElement;
    }

    while (el && !isEnd) {
        const style: CSSStyleDeclaration = getComputedStyle(el);
        const tagName = el.tagName.toLowerCase();
        const position = style.position;
        const isFixed = position === "fixed";
        const styleTransform = style.transform!;
        let matrix: number[] = convertCSStoMatrix(getTransformMatrix(styleTransform));

        if (!is3d && matrix.length === 16) {
            is3d = true;
            n = 4;
            const matrixesLength = matrixes.length;

            for (let i = 0; i < matrixesLength; ++i) {
                matrixes[i] = convertDimension(matrixes[i], 3, 4);
            }
        }
        if (is3d && matrix.length === 9) {
            matrix = convertDimension(matrix, 3, 4);
        }

        let offsetLeft = (el as HTMLElement).offsetLeft;
        let offsetTop = (el as HTMLElement).offsetTop;