How to use the @moveable/matrix.average 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 / DraggerUtils.ts View on Github external
export function getPosByDirection(
    poses: number[][],
    direction: number[],
) {
    /*
    [-1, -1](pos1)       [0, -1](pos1,pos2)       [1, -1](pos2)
    [-1, 0](pos1, pos3)                           [1, 0](pos2, pos4)
    [-1, 1](pos3)        [0, 1](pos3, pos4)       [1, 1](pos4)
    */
   const nextPoses = getPosesByDirection(poses, direction);

   return [
       average(...nextPoses.map(pos => pos[0])),
       average(...nextPoses.map(pos => pos[1])),
   ];
}
export function getPosByReverseDirection(
github daybrush / moveable / packages / react-moveable / src / react-moveable / DraggerUtils.ts View on Github external
export function getPosByDirection(
    poses: number[][],
    direction: number[],
) {
    /*
    [-1, -1](pos1)       [0, -1](pos1,pos2)       [1, -1](pos2)
    [-1, 0](pos1, pos3)                           [1, 0](pos2, pos4)
    [-1, 1](pos3)        [0, 1](pos3, pos4)       [1, 1](pos4)
    */
   const nextPoses = getPosesByDirection(poses, direction);

   return [
       average(...nextPoses.map(pos => pos[0])),
       average(...nextPoses.map(pos => pos[1])),
   ];
}
export function getPosByReverseDirection(