Move path related function into the math package

This commit is contained in:
Mark Tolmacs 2024-09-23 18:08:17 +02:00
parent 1b56cf90fb
commit 9eb08df3ea
No known key found for this signature in database
9 changed files with 72 additions and 46 deletions

View file

@ -15,8 +15,7 @@ import { isBindingElement, isLinearElement } from "../element/typeChecks";
import type { AppState } from "../types";
import { resetCursor } from "../cursor";
import { StoreAction } from "../store";
import { point } from "../../math";
import { isPathALoop } from "../shapes";
import { pathIsALoop, point } from "../../math";
export const actionFinalize = register({
name: "finalize",
@ -104,7 +103,7 @@ export const actionFinalize = register({
// If the multi point line closes the loop,
// set the last point to first point.
// This ensures that loop remains closed at different scales.
const isLoop = isPathALoop(multiPointElement.points, appState.zoom.value);
const isLoop = pathIsALoop(multiPointElement.points, appState.zoom.value);
if (
multiPointElement.type === "line" ||
multiPointElement.type === "freedraw"