UNPKG

react-input-range

Version:

React component for inputting numeric values within a range

14 lines (12 loc) 329 B
/** * Calculate the distance between pointA and pointB * @ignore * @param {Point} pointA * @param {Point} pointB * @return {number} Distance */ export default function distanceTo(pointA, pointB) { const xDiff = (pointB.x - pointA.x) ** 2; const yDiff = (pointB.y - pointA.y) ** 2; return Math.sqrt(xDiff + yDiff); }