src/tools/annotation/bidirectionalTool/moveHandle/moveLongLine/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
 *
 * @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

@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 @returns { * } Returns a line object with the updated handles position
function updatePerpendicularLine(baseData, mid) {
  const {
    columnPixelSpacing,
    rowPixelSpacing,
    start,
    perpendicularStart,
    perpendicularEnd,
    intersection,
    fixedPoint,
  } = baseData;
  const distancePS = getDistanceWithPixelSpacing(
    columnPixelSpacing,
    rowPixelSpacing,
    perpendicularStart,
    intersection
  );
  const distancePE = getDistanceWithPixelSpacing(
    columnPixelSpacing,
    rowPixelSpacing,
    perpendicularEnd,
    intersection
  );
  const vector = getLineVector(
    columnPixelSpacing,
    rowPixelSpacing,
    fixedPoint,
    mid
  );
  const multiplier = fixedPoint === start ? 1 : -1;
  const rowMultiplier = multiplier * rowPixelSpacing;
  const columnMultiplier = multiplier * columnPixelSpacing;
  return {
    start: {
      x: mid.x + vector.y * distancePS * rowMultiplier,
      y: mid.y + vector.x * distancePS * columnMultiplier * -1,
    },
    end: {
      x: mid.x + vector.y * distancePE * rowMultiplier * -1,
      y: mid.y + vector.x * distancePE * columnMultiplier,
    },
  };
}
function updatePerpendicularLine ( baseData , mid ) { const { columnPixelSpacing , rowPixelSpacing , start , perpendicularStart , perpendicularEnd , intersection , fixedPoint , } = baseData ; const distancePS = getDistanceWithPixelSpacing ( columnPixelSpacing , rowPixelSpacing , perpendicularStart , intersection ) ; const distancePE = getDistanceWithPixelSpacing ( columnPixelSpacing , rowPixelSpacing , perpendicularEnd , intersection ) ; const vector = getLineVector ( columnPixelSpacing , rowPixelSpacing , fixedPoint , mid ) ; const multiplier = fixedPoint === start ? 1 : - 1 ; const rowMultiplier = multiplier * rowPixelSpacing ; const columnMultiplier = multiplier * columnPixelSpacing ; return { start : { x : mid . x + vector . y * distancePS * rowMultiplier , y : mid . y + vector . x * distancePS * columnMultiplier * - 1 , } , end : { x : mid . x + vector . y * distancePE * rowMultiplier * - 1 , y : mid . y + vector . x * distancePE * columnMultiplier , } , } ; }
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 original distance from perpendicular start handle to intersection // Get the original distance from perpendicular end handle to intersection // Inclination of the perpendicular line // Define the multiplier // Calculate and return the new position of the perpendicular handles