mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Rectangle distance and tests
This commit is contained in:
parent
9a8aabbeca
commit
47cc842415
5 changed files with 72 additions and 25 deletions
|
@ -1,4 +1,3 @@
|
|||
import { invariant } from "../excalidraw/utils";
|
||||
import {
|
||||
isPoint,
|
||||
pointCenter,
|
||||
|
@ -23,10 +22,9 @@ import {
|
|||
* @returns The line segment delineated by the points
|
||||
*/
|
||||
export function segment<P extends GenericPoint>(a: P, b: P): Segment<P> {
|
||||
invariant(
|
||||
!pointsEqual(a, b),
|
||||
"The start and end points of the segment cannot match",
|
||||
);
|
||||
if (pointsEqual(a, b)) {
|
||||
console.warn("The start and end points of the segment cannot match");
|
||||
}
|
||||
|
||||
return [a, b] as Segment<P>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue