mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Revert to master
This commit is contained in:
parent
5947af5b50
commit
b33cc74183
25 changed files with 410 additions and 577 deletions
|
@ -157,13 +157,22 @@ export function curveIntersectLineSegment<
|
|||
return bezierEquation(c, t);
|
||||
};
|
||||
|
||||
const solutions = [
|
||||
calculate(initial_guesses[0]),
|
||||
calculate(initial_guesses[1]),
|
||||
calculate(initial_guesses[2]),
|
||||
].filter((x, i, a): x is Point => x !== null && a.indexOf(x) === i);
|
||||
let solution = calculate(initial_guesses[0]);
|
||||
if (solution) {
|
||||
return [solution];
|
||||
}
|
||||
|
||||
return solutions;
|
||||
solution = calculate(initial_guesses[1]);
|
||||
if (solution) {
|
||||
return [solution];
|
||||
}
|
||||
|
||||
solution = calculate(initial_guesses[2]);
|
||||
if (solution) {
|
||||
return [solution];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -91,10 +91,9 @@ export function isPoint(p: unknown): p is LocalPoint | GlobalPoint {
|
|||
export function pointsEqual<Point extends GlobalPoint | LocalPoint>(
|
||||
a: Point,
|
||||
b: Point,
|
||||
precision = PRECISION,
|
||||
): boolean {
|
||||
const abs = Math.abs;
|
||||
return abs(a[0] - b[0]) < precision && abs(a[1] - b[1]) < precision;
|
||||
return abs(a[0] - b[0]) < PRECISION && abs(a[1] - b[1]) < PRECISION;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,7 +6,7 @@ export const clamp = (value: number, min: number, max: number) => {
|
|||
|
||||
export const round = (
|
||||
value: number,
|
||||
precision: number = (Math.log(1 / PRECISION) * Math.LOG10E + 1) | 0,
|
||||
precision: number,
|
||||
func: "round" | "floor" | "ceil" = "round",
|
||||
) => {
|
||||
const multiplier = Math.pow(10, precision);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue