Type refactor

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
Mark Tolmacs 2025-01-14 18:34:05 +01:00
parent 47064a3662
commit 2137f2b806
No known key found for this signature in database
6 changed files with 63 additions and 262 deletions

View file

@ -164,14 +164,14 @@ export const getElementShape = (
const [, , , , cx, cy] = getElementAbsoluteCoords(element, elementsMap);
return shouldTestInside(element)
? getClosedCurveShape<GlobalPoint>(
? getClosedCurveShape(
element,
roughShape,
pointFrom<GlobalPoint>(element.x, element.y),
element.angle,
pointFrom(cx, cy),
)
: getCurveShape<GlobalPoint>(
: getCurveShape(
roughShape,
pointFrom<GlobalPoint>(element.x, element.y),
element.angle,

View file

@ -1,4 +1,4 @@
import type { Arc, CubicBezier, Segment } from "../math";
import type { Arc, Curve, Segment } from "../math";
import { isSegment, segment, pointFrom, type GlobalPoint } from "../math";
import { isBounds } from "./element/typeChecks";
import type { Bounds } from "./element/types";
@ -15,12 +15,12 @@ declare global {
export type DebugElement = {
color: string;
data: Segment<GlobalPoint> | Arc<GlobalPoint> | CubicBezier<GlobalPoint>;
data: Segment<GlobalPoint> | Arc<GlobalPoint> | Curve<GlobalPoint>;
permanent: boolean;
};
export const debugDrawCubicBezier = (
c: CubicBezier<GlobalPoint>,
c: Curve<GlobalPoint>,
opts?: {
color?: string;
permanent?: boolean;