function pointNearHandle(element, data, coords) {
  var config = freehand.getConfiguration();

  if (data.handles === undefined) {
    return null;
  }

  if (data.visible === false) {
    return null;
  }

  for (var i = 0; i < data.handles.length; i++) {
    var handleCanvas = _externalModules2.default.cornerstone.pixelToCanvas(element, data.handles[i]);

    if (_externalModules2.default.cornerstoneMath.point.distance(handleCanvas, coords) < config.spacing) {
      return i;
    }
  }

  // Check to see if mouse in bounding box of textbox
  if (data.textBox) {
    if ((0, _pointInsideBoundingBox2.default)(data.textBox, coords)) {
      return data.textBox;
    }
  }

  return null;
}
/**
* Returns a handle of a particular tool if it is close to the mouse cursor
*
* @param {Object} eventData - data object associated with an event.
* @param {Number} toolIndex - the ID of the tool
* @return {Number|Object|Boolean}
*/
Returns a handle of a particular tool if it is close to the mouse cursor
Returns a handle of a particular tool if it is close to the mouse cursor
function pointNearHandle(element, data, coords) {
  var config = freehand.getConfiguration();
  if (data.handles === undefined) {
    return null;
  }
  if (data.visible === false) {
    return null;
  }
  for (var i = 0; i < data.handles.length; i++) {
    var handleCanvas = _externalModules2.default.cornerstone.pixelToCanvas(element, data.handles[i]);
    if (_externalModules2.default.cornerstoneMath.point.distance(handleCanvas, coords) < config.spacing) {
      return i;
    }
  }
  if (data.textBox) {
    if ((0, _pointInsideBoundingBox2.default)(data.textBox, coords)) {
      return data.textBox;
    }
  }
  return null;
}
function pointNearHandle ( element , data , coords ) { var config = freehand . getConfiguration ( ) ; if ( data . handles === undefined ) { return null ; } if ( data . visible === false ) { return null ; } for ( var i = 0 ; i < data . handles . length ; i ++ ) { var handleCanvas = _externalModules2 . default . cornerstone . pixelToCanvas ( element , data . handles [ i ] ) ; if ( _externalModules2 . default . cornerstoneMath . point . distance ( handleCanvas , coords ) < config . spacing ) { return i ; } } if ( data . textBox ) { if ( ( 0 , _pointInsideBoundingBox2 . default ) ( data . textBox , coords ) ) { return data . textBox ; } } return null ; }
Returns a handle of a particular tool if it is close to the mouse cursor
Returns a handle of a particular tool if it is close to the mouse cursor
// Check to see if mouse in bounding box of textbox