* Get a distance metric function for two points based on the * axis mode setting * @param {string} axis - the axis mode. x|y|xy|r
(axis)
| 92 | * @param {string} axis - the axis mode. x|y|xy|r |
| 93 | */ |
| 94 | function getDistanceMetricForAxis(axis) { |
| 95 | const useX = axis.indexOf('x') !== -1; |
| 96 | const useY = axis.indexOf('y') !== -1; |
| 97 | |
| 98 | return function(pt1, pt2) { |
| 99 | const deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0; |
| 100 | const deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0; |
| 101 | return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2)); |
| 102 | }; |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Helper function to get the items that intersect the event position |
no outgoing calls
no test coverage detected
searching dependent graphs…