function insertPoint(eventData, insertInfo) {
  var toolData = (0, _toolState.getToolState)(eventData.element, toolType);

  if (toolData === undefined) {
    return;
  }

  // Get the toolData from insertInfo
  var data = toolData.data[insertInfo.toolIndex];

  var insertIndex = getInsertionIndex(insertInfo);

  if (insertIndex === Infinity) {
    return;
  }

  var handleData = new _FreehandHandleData.FreehandHandleData(eventData.currentPoints.image);

  // Add the new handle
  data.handles.splice(insertIndex, 0, handleData);

  // Add the line from the previous handle to the inserted handle (note the tool is now one increment longer)
  data.handles[insertIndex - 1].lines.pop();
  data.handles[insertIndex - 1].lines.push(eventData.currentPoints.image);

  // Add the line from the inserted handle to the handle after
  if (insertIndex === data.handles.length - 1) {
    data.handles[insertIndex].lines.push(data.handles[0]);
  } else {
    data.handles[insertIndex].lines.push(data.handles[insertIndex + 1]);
  }

  data.active = true;
  data.highlight = true;

  // Force onImageRendered to fire
  data.invalidated = true;
  _externalModules2.default.cornerstone.updateImage(eventData.element);
}
/**
* Inserts a new point into a freehand tool.
*
* @param {Object} eventData - The data object associated with the event.
* @param {Object} insertInfo - Object containing information about where to insert the point.
*/
Inserts a new point into a freehand tool.
Inserts a new point into a freehand tool .
function insertPoint(eventData, insertInfo) {
  var toolData = (0, _toolState.getToolState)(eventData.element, toolType);
  if (toolData === undefined) {
    return;
  }
  var data = toolData.data[insertInfo.toolIndex];
  var insertIndex = getInsertionIndex(insertInfo);
  if (insertIndex === Infinity) {
    return;
  }
  var handleData = new _FreehandHandleData.FreehandHandleData(eventData.currentPoints.image);
  data.handles.splice(insertIndex, 0, handleData);
  data.handles[insertIndex - 1].lines.pop();
  data.handles[insertIndex - 1].lines.push(eventData.currentPoints.image);
  if (insertIndex === data.handles.length - 1) {
    data.handles[insertIndex].lines.push(data.handles[0]);
  } else {
    data.handles[insertIndex].lines.push(data.handles[insertIndex + 1]);
  }
  data.active = true;
  data.highlight = true;
  data.invalidated = true;
  _externalModules2.default.cornerstone.updateImage(eventData.element);
}
function insertPoint ( eventData , insertInfo ) { var toolData = ( 0 , _toolState . getToolState ) ( eventData . element , toolType ) ; if ( toolData === undefined ) { return ; } var data = toolData . data [ insertInfo . toolIndex ] ; var insertIndex = getInsertionIndex ( insertInfo ) ; if ( insertIndex === Infinity ) { return ; } var handleData = new _FreehandHandleData . FreehandHandleData ( eventData . currentPoints . image ) ; data . handles . splice ( insertIndex , 0 , handleData ) ; data . handles [ insertIndex - 1 ] . lines . pop ( ) ; data . handles [ insertIndex - 1 ] . lines . push ( eventData . currentPoints . image ) ; if ( insertIndex === data . handles . length - 1 ) { data . handles [ insertIndex ] . lines . push ( data . handles [ 0 ] ) ; } else { data . handles [ insertIndex ] . lines . push ( data . handles [ insertIndex + 1 ] ) ; } data . active = true ; data . highlight = true ; data . invalidated = true ; _externalModules2 . default . cornerstone . updateImage ( eventData . element ) ; }
Inserts a new point into a freehand tool.
Inserts a new point into a freehand tool .
// Get the toolData from insertInfo // Add the new handle // Add the line from the previous handle to the inserted handle (note the tool is now one increment longer) // Add the line from the inserted handle to the handle after // Force onImageRendered to fire