Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
offsetMatrix,
targetMatrix,
transformOrigin,
} = moveable.state;
const n = is3d ? 4 : 3;
datas.is3d = is3d;
datas.matrix = matrix;
datas.targetMatrix = targetMatrix;
datas.beforeMatrix = beforeMatrix;
datas.offsetMatrix = offsetMatrix;
datas.transformOrigin = transformOrigin;
datas.inverseMatrix = invert(matrix, n);
datas.inverseBeforeMatrix = invert(beforeMatrix, n);
datas.absoluteOrigin = convertPositionMatrix(plus([left, top], origin), n);
datas.startDragBeforeDist = caculate(datas.inverseBeforeMatrix, datas.absoluteOrigin, n);
datas.startDragDist = caculate(datas.inverseMatrix, datas.absoluteOrigin, n);
}
export function getDragDist({ datas, distX, distY }: any, isBefore?: boolean) {
datas.nextPoses = datas.poses.map(([x, y]: number[]) => caculate(datas.warpTargetMatrix, [x, y, 0, 1], 4));
datas.startMatrix = createIdentityMatrix(4);
export function getDragDist({ datas, distX, distY }: any, isBefore?: boolean) {
const {
inverseBeforeMatrix,
inverseMatrix, is3d,
startDragBeforeDist,
startDragDist,
absoluteOrigin,
} = datas;
const n = is3d ? 4 : 3;
return minus(
caculate(
isBefore ? inverseBeforeMatrix : inverseMatrix,
plus(absoluteOrigin, [distX, distY]),
n,
),
isBefore ? startDragBeforeDist : startDragDist,
);
}
export function caculateTransformOrigin(
(child, childDatas) => {
const pos = getPosByReverseDirection(getAbsolutePosesByState(child.state), direction);
const [originalX, originalY] = caculate(
createRotateMatrix(-moveable.rotation / 180 * Math.PI, 3),
[pos[0] - startPos[0], pos[1] - startPos[1], 1],
3,
);
childDatas.originalX = originalX;
childDatas.originalY = originalY;
return e;
},
);
targetMatrix,
transformOrigin,
} = moveable.state;
const n = is3d ? 4 : 3;
datas.is3d = is3d;
datas.matrix = matrix;
datas.targetMatrix = targetMatrix;
datas.beforeMatrix = beforeMatrix;
datas.offsetMatrix = offsetMatrix;
datas.transformOrigin = transformOrigin;
datas.inverseMatrix = invert(matrix, n);
datas.inverseBeforeMatrix = invert(beforeMatrix, n);
datas.absoluteOrigin = convertPositionMatrix(plus([left, top], origin), n);
datas.startDragBeforeDist = caculate(datas.inverseBeforeMatrix, datas.absoluteOrigin, n);
datas.startDragDist = caculate(datas.inverseMatrix, datas.absoluteOrigin, n);
}
export function getDragDist({ datas, distX, distY }: any, isBefore?: boolean) {
(child, childDatas) => {
const pos = getPosByReverseDirection(getAbsolutePosesByState(child.state), direction);
const [originalX, originalY] = caculate(
createRotateMatrix(-moveable.rotation / 180 * Math.PI, 3),
[pos[0] - startPos[0], pos[1] - startPos[1], 1],
3,
);
childDatas.originalX = originalX;
childDatas.originalY = originalY;
return e;
},
);