src/tools/annotation/bidirectionalTool/moveHandle/movePerpendicularLine/updatePerpendicularLine.js
/**
 * Returns the updated line object that will be used to change the position of
 * the perpendicular line handles.
 *
 * @param {*} baseData Base data for bidirectional line moving
 * @param {*} mid Middle point considering the proposed point
 * @param {*} helperLine Line based on proposed point that crosses long line
 * @param {*} vector Vector with the perpendicular line inclination
 *
 * @returns {*} Returns a line object with the updated handles position
 */
Returns the updated line object that will be used to change the position of
the perpendicular line handles.

@param {*} baseData Base data for bidirectional line moving
@param {*} mid Middle point considering the proposed point
@param {*} helperLine Line based on proposed point that crosses long line
@param {*} vector Vector with the perpendicular line inclination

@returns {*} Returns a line object with the updated handles position
Returns the updated line object that will be used to change the position of the perpendicular line handles . @param { * } baseData Base data for bidirectional line moving @param { * } mid Middle point considering the proposed point @param { * } helperLine Line based on proposed point that crosses long line @param { * } vector Vector with the perpendicular line inclination @returns { * } Returns a line object with the updated handles position
function updatePerpendicularLine(
  baseData,
  mid,
  helperLine,
  vector
) {
  const {
    columnPixelSpacing,
    rowPixelSpacing,
    fixedPoint,
    perpendicularStart,
    perpendicularEnd,
    distanceToFixed,
  } = baseData;
  const multiplier =
    getDirectionMultiplier(fixedPoint, perpendicularEnd) * distanceToFixed;
  const movingPoint = getMovingPoint(
    fixedPoint,
    perpendicularStart,
    perpendicularEnd
  );
  const isMovingStart = movingPoint === perpendicularStart;
  const movingKey = isMovingStart ? 'start' : 'end';
  const fixedKey = isMovingStart ? 'end' : 'start';
  return {
    [movingKey]: {
      x: helperLine.start.x,
      y: helperLine.start.y,
    },
    [fixedKey]: {
      x: mid.x + vector.y * rowPixelSpacing * multiplier,
      y: mid.y + vector.x * columnPixelSpacing * multiplier * -1,
    },
  };
}
function updatePerpendicularLine ( baseData , mid , helperLine , vector ) { const { columnPixelSpacing , rowPixelSpacing , fixedPoint , perpendicularStart , perpendicularEnd , distanceToFixed , } = baseData ; const multiplier = getDirectionMultiplier ( fixedPoint , perpendicularEnd ) * distanceToFixed ; const movingPoint = getMovingPoint ( fixedPoint , perpendicularStart , perpendicularEnd ) ; const isMovingStart = movingPoint === perpendicularStart ; const movingKey = isMovingStart ? 'start' : 'end' ; const fixedKey = isMovingStart ? 'end' : 'start' ; return { [ movingKey ] : { x : helperLine . start . x , y : helperLine . start . y , } , [ fixedKey ] : { x : mid . x + vector . y * rowPixelSpacing * multiplier , y : mid . y + vector . x * columnPixelSpacing * multiplier * - 1 , } , } ; }
Returns the updated line object that will be used to change the position of
 the perpendicular line handles.
Returns the updated line object that will be used to change the position of the perpendicular line handles .
// Get the multiplier // Define the moving point // Get the object keys for moving and fixed points // Calculate and return the new position of the perpendicular handles