function modify(dataHandles, modifiedHandleId) {
  // Check if the modifiedHandle's previous and next lines will intersect any other line in the polygon
  var modifiedHandle = getCoords(dataHandles[modifiedHandleId]);

  // Previous neightbor handle
  var neighborHandleId = modifiedHandleId - 1;

  if (modifiedHandleId === 0) {
    neighborHandleId = dataHandles.length - 1;
  }

  var neighborHandle = getCoords(dataHandles[neighborHandleId]);

  if (doesIntersectOtherLines(dataHandles, modifiedHandle, neighborHandle, [modifiedHandleId, neighborHandleId])) {
    return true;
  }

  // Next neightbor handle
  if (modifiedHandleId === dataHandles.length - 1) {
    neighborHandleId = 0;
  } else {
    neighborHandleId = modifiedHandleId + 1;
  }

  neighborHandle = getCoords(dataHandles[neighborHandleId]);

  return doesIntersectOtherLines(dataHandles, modifiedHandle, neighborHandle, [modifiedHandleId, neighborHandleId]);
}
/**
* Checks whether the modification of a handle's position causes intersection of the lines of the polygon
*
* @param {Object} dataHandles - data object associated with the tool.
* @param {Number} modifiedHandleId - The id of the handle being modified.
* @return {Boolean} - Whether the modfication causes any intersections.
*/
Checks whether the modification of a handle's position causes intersection of the lines of the polygon
Checks whether the modification of a handle ' s position causes intersection of the lines of the polygon
function modify(dataHandles, modifiedHandleId) {
  var modifiedHandle = getCoords(dataHandles[modifiedHandleId]);
  var neighborHandleId = modifiedHandleId - 1;
  if (modifiedHandleId === 0) {
    neighborHandleId = dataHandles.length - 1;
  }
  var neighborHandle = getCoords(dataHandles[neighborHandleId]);
  if (doesIntersectOtherLines(dataHandles, modifiedHandle, neighborHandle, [modifiedHandleId, neighborHandleId])) {
    return true;
  }
  if (modifiedHandleId === dataHandles.length - 1) {
    neighborHandleId = 0;
  } else {
    neighborHandleId = modifiedHandleId + 1;
  }
  neighborHandle = getCoords(dataHandles[neighborHandleId]);
  return doesIntersectOtherLines(dataHandles, modifiedHandle, neighborHandle, [modifiedHandleId, neighborHandleId]);
}
function modify ( dataHandles , modifiedHandleId ) { var modifiedHandle = getCoords ( dataHandles [ modifiedHandleId ] ) ; var neighborHandleId = modifiedHandleId - 1 ; if ( modifiedHandleId === 0 ) { neighborHandleId = dataHandles . length - 1 ; } var neighborHandle = getCoords ( dataHandles [ neighborHandleId ] ) ; if ( doesIntersectOtherLines ( dataHandles , modifiedHandle , neighborHandle , [ modifiedHandleId , neighborHandleId ] ) ) { return true ; } if ( modifiedHandleId === dataHandles . length - 1 ) { neighborHandleId = 0 ; } else { neighborHandleId = modifiedHandleId + 1 ; } neighborHandle = getCoords ( dataHandles [ neighborHandleId ] ) ; return doesIntersectOtherLines ( dataHandles , modifiedHandle , neighborHandle , [ modifiedHandleId , neighborHandleId ] ) ; }
Checks whether the modification of a handle's position causes intersection of the lines of the polygon
Checks whether the modification of a handle ' s position causes intersection of the lines of the polygon
// Check if the modifiedHandle's previous and next lines will intersect any other line in the polygon // Previous neightbor handle // Next neightbor handle