More refactor

This commit is contained in:
Mark Tolmacs 2024-09-25 11:59:27 +02:00
parent 392dd5b0b8
commit b697f63cad
No known key found for this signature in database
18 changed files with 206 additions and 199 deletions

View file

@ -65,7 +65,7 @@ import {
} from "./heading";
import type { LocalPoint, Radians } from "../../math";
import {
lineSegment,
segment,
point,
pointRotateRads,
type GlobalPoint,
@ -1615,7 +1615,7 @@ const intersectElementWithLine = (
elementsMap: ElementsMap,
): GlobalPoint[] | undefined => {
if (isRectangularElement(element)) {
return segmentIntersectRectangleElement(element, lineSegment(a, b), gap);
return segmentIntersectRectangleElement(element, segment(a, b), gap);
}
const relateToCenter = relativizationToElementCenter(element, elementsMap);

View file

@ -21,10 +21,10 @@ import type { Bounds } from "./bounds";
import { getElementAbsoluteCoords } from "./bounds";
import { SIDE_RESIZING_THRESHOLD } from "../constants";
import { isLinearElement } from "./typeChecks";
import type { GlobalPoint, LineSegment, LocalPoint } from "../../math";
import type { GlobalPoint, Segment, LocalPoint } from "../../math";
import {
point,
pointOnLineSegment,
segmentIncludesPoint,
pointRotateRads,
type Radians,
} from "../../math";
@ -101,9 +101,9 @@ export const resizeTest = <Point extends GlobalPoint | LocalPoint>(
for (const [dir, side] of Object.entries(sides)) {
// test to see if x, y are on the line segment
if (
pointOnLineSegment(
segmentIncludesPoint(
point<Point>(x, y),
side as LineSegment<Point>,
side as Segment<Point>,
SPACING,
)
) {
@ -187,9 +187,9 @@ export const getTransformHandleTypeFromCoords = (
for (const [dir, side] of Object.entries(sides)) {
// test to see if x, y are on the line segment
if (
pointOnLineSegment(
segmentIncludesPoint(
scenePointer,
side as LineSegment<GlobalPoint>,
side as Segment<GlobalPoint>,
SPACING,
)
) {