MCPcopy
hub / github.com/react-dnd/react-dnd / distance

Function distance

packages/backend-touch/src/utils/math.ts:3–12  ·  view source on GitHub ↗
(
	x1: number,
	y1: number,
	x2: number,
	y2: number,
)

Source from the content-addressed store, hash-verified

1import type { AngleRange } from '../interfaces.js'
2
3export function distance(
4 x1: number,
5 y1: number,
6 x2: number,
7 y2: number,
8): number {
9 return Math.sqrt(
10 Math.pow(Math.abs(x2 - x1), 2) + Math.pow(Math.abs(y2 - y1), 2),
11 )
12}
13
14export function inAngleRanges(
15 x1: number,

Callers 1

TouchBackendImplClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…