src/core/core.interaction.js
function getDistanceMetricForAxis(axis) {
	var useX = axis.indexOf('x') !== -1;
	var useY = axis.indexOf('y') !== -1;

	return function(pt1, pt2) {
		var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;
		var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;
		return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
	};
}
function getDistanceMetricForAxis(axis) {
	var useX = axis.indexOf('x') !== -1;
	var useY = axis.indexOf('y') !== -1;

	return function(pt1, pt2) {
		var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;
		var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;
		return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
	};
}
function getDistanceMetricForAxis ( axis ) { var useX = axis . indexOf ( 'x' ) !== - 1 ; var useY = axis . indexOf ( 'y' ) !== - 1 ; return function ( pt1 , pt2 ) { var deltaX = useX ? Math . abs ( pt1 . x - pt2 . x ) : 0 ; var deltaY = useY ? Math . abs ( pt1 . y - pt2 . y ) : 0 ; return Math . sqrt ( Math . pow ( deltaX , 2 ) + Math . pow ( deltaY , 2 ) ) ; } ; }
Get a distance metric function for two points based on the
axis mode setting
@param {string} axis - the axis mode. x|y|xy
Get a distance metric function for two points based on the axis mode setting