mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
More refactor
This commit is contained in:
parent
392dd5b0b8
commit
b697f63cad
18 changed files with 206 additions and 199 deletions
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
)
|
||||
) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue