mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: Remove GA code from binding (#9042)
Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
parent
31e8476c78
commit
0ffeaeaecf
44 changed files with 2112 additions and 1832 deletions
|
@ -57,24 +57,9 @@ export function pointFromPair<Point extends GlobalPoint | LocalPoint>(
|
|||
*/
|
||||
export function pointFromVector<P extends GlobalPoint | LocalPoint>(
|
||||
v: Vector,
|
||||
offset: P = pointFrom(0, 0),
|
||||
): P {
|
||||
return v as unknown as P;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the coordiante object to a point.
|
||||
*
|
||||
* @param coords The coordinate object with x and y properties
|
||||
* @returns
|
||||
*/
|
||||
export function pointFromCoords<Point extends GlobalPoint | LocalPoint>({
|
||||
x,
|
||||
y,
|
||||
}: {
|
||||
x: number;
|
||||
y: number;
|
||||
}) {
|
||||
return [x, y] as Point;
|
||||
return pointFrom<P>(offset[0] + v[0], offset[1] + v[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -176,36 +161,6 @@ export function pointCenter<P extends LocalPoint | GlobalPoint>(a: P, b: P): P {
|
|||
return pointFrom((a[0] + b[0]) / 2, (a[1] + b[1]) / 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add together two points by their coordinates like you'd apply a translation
|
||||
* to a point by a vector.
|
||||
*
|
||||
* @param a One point to act as a basis
|
||||
* @param b The other point to act like the vector to translate by
|
||||
* @returns
|
||||
*/
|
||||
export function pointAdd<Point extends LocalPoint | GlobalPoint>(
|
||||
a: Point,
|
||||
b: Point,
|
||||
): Point {
|
||||
return pointFrom(a[0] + b[0], a[1] + b[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Subtract a point from another point like you'd translate a point by an
|
||||
* invese vector.
|
||||
*
|
||||
* @param a The point to translate
|
||||
* @param b The point which will act like a vector
|
||||
* @returns The resulting point
|
||||
*/
|
||||
export function pointSubtract<Point extends LocalPoint | GlobalPoint>(
|
||||
a: Point,
|
||||
b: Point,
|
||||
): Point {
|
||||
return pointFrom(a[0] - b[0], a[1] - b[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the distance between two points.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue