src/tools/annotation/bidirectionalTool/moveHandle/moveLongLine/moveLongLine.js
/**
 * Move the long line updating the perpendicular line handles position.
 *
 * @param {*} proposedPoint Point that was moved in bidirectional tool
 * @param {*} measurementData Data from current bidirectional tool measurement
 * @param {*} eventData Data object associated with the event
 * @param {*} fixedPoint Point that is not being moved in long line
 *
 * @returns {boolean} True if perpendicular handles were updated, false if not
 */
Move the long line updating the perpendicular line handles position.
@param {*} proposedPoint Point that was moved in bidirectional tool
@param {*} measurementData Data from current bidirectional tool measurement
@param {*} eventData Data object associated with the event
@param {*} fixedPoint Point that is not being moved in long line

@returns {boolean} True if perpendicular handles were updated, false if not
Move the long line updating the perpendicular line handles position . @param { * } proposedPoint Point that was moved in bidirectional tool @param { * } measurementData Data from current bidirectional tool measurement @param { * } eventData Data object associated with the event @param { * } fixedPoint Point that is not being moved in long line @returns { boolean } True if perpendicular handles were updated false if not
function moveLongLine(
  proposedPoint,
  measurementData,
  eventData,
  fixedPoint
) {
  const baseData = getBaseData(measurementData, eventData, fixedPoint);
  const { columnPixelSpacing, rowPixelSpacing, distanceToFixed } = baseData;
  const newLineLength = getDistanceWithPixelSpacing(
    columnPixelSpacing,
    rowPixelSpacing,
    fixedPoint,
    proposedPoint
  );
  if (newLineLength <= distanceToFixed) {
    return false;
  }
  const distanceRatio = distanceToFixed / newLineLength;
  const newIntersection = {
    x: fixedPoint.x + (proposedPoint.x - fixedPoint.x) * distanceRatio,
    y: fixedPoint.y + (proposedPoint.y - fixedPoint.y) * distanceRatio,
  };
  const newLine = updatePerpendicularLine(baseData, newIntersection);
  measurementData.handles.perpendicularStart.x = newLine.start.x;
  measurementData.handles.perpendicularStart.y = newLine.start.y;
  measurementData.handles.perpendicularEnd.x = newLine.end.x;
  measurementData.handles.perpendicularEnd.y = newLine.end.y;
  return true;
}
function moveLongLine ( proposedPoint , measurementData , eventData , fixedPoint ) { const baseData = getBaseData ( measurementData , eventData , fixedPoint ) ; const { columnPixelSpacing , rowPixelSpacing , distanceToFixed } = baseData ; const newLineLength = getDistanceWithPixelSpacing ( columnPixelSpacing , rowPixelSpacing , fixedPoint , proposedPoint ) ; if ( newLineLength <= distanceToFixed ) { return false ; } const distanceRatio = distanceToFixed / newLineLength ; const newIntersection = { x : fixedPoint . x + ( proposedPoint . x - fixedPoint . x ) * distanceRatio , y : fixedPoint . y + ( proposedPoint . y - fixedPoint . y ) * distanceRatio , } ; const newLine = updatePerpendicularLine ( baseData , newIntersection ) ; measurementData . handles . perpendicularStart . x = newLine . start . x ; measurementData . handles . perpendicularStart . y = newLine . start . y ; measurementData . handles . perpendicularEnd . x = newLine . end . x ; measurementData . handles . perpendicularEnd . y = newLine . end . y ; return true ; }
Move the long line updating the perpendicular line handles position.
Move the long line updating the perpendicular line handles position .
// Calculate the length of the new line, considering the proposed point // Stop here if the handle tries to move before the intersection point // Calculate the new intersection point // Calculate and the new position of the perpendicular handles // Update the perpendicular line handles