function positionMirror({withFrame = false, initial = false} = {}) {
  return ({
    mirror,
    sensorEvent,
    mirrorOffset,
    initialY,
    initialX,
    scrollOffset,
    options,
    passedThreshX,
    passedThreshY,
    lastMovedX,
    lastMovedY,
    ...args
  }) => {
    return withPromise(
      (resolve) => {
        const result = {
          mirror,
          sensorEvent,
          mirrorOffset,
          options,
          ...args,
        };

        if (mirrorOffset) {
          const x = passedThreshX
            ? Math.round(
                (sensorEvent.clientX - mirrorOffset.left - scrollOffset.x) /
                  (options.thresholdX || 1),
              ) * (options.thresholdX || 1)
            : Math.round(lastMovedX);
          const y = passedThreshY
            ? Math.round(
                (sensorEvent.clientY - mirrorOffset.top - scrollOffset.y) /
                  (options.thresholdY || 1),
              ) * (options.thresholdY || 1)
            : Math.round(lastMovedY);

          if ((options.xAxis && options.yAxis) || initial) {
            mirror.style.transform = `translate3d(${x}px, ${y}px, 0)`;
          } else if (options.xAxis && !options.yAxis) {
            mirror.style.transform = `translate3d(${x}px, ${initialY}px, 0)`;
          } else if (options.yAxis && !options.xAxis) {
            mirror.style.transform = `translate3d(${initialX}px, ${y}px, 0)`;
          }

          if (initial) {
            result.initialX = x;
            result.initialY = y;
          }

          result.lastMovedX = x;
          result.lastMovedY = y;
        }

        resolve(result);
      },
      {frame: withFrame},
    );
  };
}
Positions mirror with translate3d
@param {Object} state
@param {HTMLElement} state.mirror
@param {SensorEvent} state.sensorEvent
@param {Object} state.mirrorOffset
@param {Number} state.initialY
@param {Number} state.initialX
@param {Object} state.options
@return {Promise}
@private