@zsviczian/excalidraw 0.17.6-25 → 0.17.6-27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/excalidraw.development.js +127 -94
- package/dist/excalidraw.production.min.js +1 -1
- package/dist/styles.development.css +18 -48
- package/dist/styles.production.css +3 -3
- package/package.json +4 -2
- package/types/excalidraw/actions/actionAddToLibrary.d.ts +3 -3
- package/types/excalidraw/actions/actionBoundText.d.ts +2 -2
- package/types/excalidraw/actions/actionCanvas.d.ts +14 -14
- package/types/excalidraw/actions/actionClipboard.d.ts +13 -9
- package/types/excalidraw/actions/actionCropEditor.d.ts +1 -1
- package/types/excalidraw/actions/actionDeleteSelected.d.ts +10 -6
- package/types/excalidraw/actions/actionElementLock.d.ts +2 -2
- package/types/excalidraw/actions/actionExport.d.ts +8 -8
- package/types/excalidraw/actions/actionFinalize.d.ts +2 -2
- package/types/excalidraw/actions/actionFrame.d.ts +500 -4
- package/types/excalidraw/actions/actionGroup.d.ts +2 -2
- package/types/excalidraw/actions/actionLinearEditor.d.ts +1 -1
- package/types/excalidraw/actions/actionLink.d.ts +1 -1
- package/types/excalidraw/actions/actionMenu.d.ts +2 -2
- package/types/excalidraw/actions/actionNavigate.d.ts +2 -2
- package/types/excalidraw/actions/actionProperties.d.ts +15 -15
- package/types/excalidraw/actions/actionSelectAll.d.ts +1 -1
- package/types/excalidraw/actions/actionStyles.d.ts +1 -1
- package/types/excalidraw/actions/actionToggleGridMode.d.ts +1 -1
- package/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +1 -1
- package/types/excalidraw/actions/actionToggleSearchMenu.d.ts +1 -1
- package/types/excalidraw/actions/actionToggleStats.d.ts +1 -1
- package/types/excalidraw/actions/actionToggleViewMode.d.ts +1 -1
- package/types/excalidraw/actions/actionToggleZenMode.d.ts +1 -1
- package/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/types/excalidraw/actions/types.d.ts +1 -1
- package/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/types/excalidraw/components/EyeDropper.d.ts +1 -1
- package/types/excalidraw/components/IconPicker.d.ts +2 -2
- package/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- package/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/types/excalidraw/components/SearchMenu.d.ts +1 -1
- package/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
- package/types/excalidraw/components/Stats/Collapsible.d.ts +2 -1
- package/types/excalidraw/components/icons.d.ts +9 -0
- package/types/excalidraw/context/tunnels.d.ts +2 -1
- package/types/excalidraw/data/filesystem.d.ts +2 -1
- package/types/excalidraw/data/image.d.ts +0 -6
- package/types/excalidraw/data/library.d.ts +9 -3
- package/types/excalidraw/data/url.d.ts +0 -1
- package/types/excalidraw/editor-jotai.d.ts +56 -0
- package/types/excalidraw/element/binding.d.ts +1 -1
- package/types/excalidraw/element/elbowArrow.d.ts +14 -0
- package/types/excalidraw/element/embeddable.d.ts +1 -1
- package/types/excalidraw/element/heading.d.ts +5 -1
- package/types/excalidraw/element/linearElementEditor.d.ts +9 -11
- package/types/excalidraw/element/mutateElement.d.ts +3 -1
- package/types/excalidraw/element/newElement.d.ts +8 -7
- package/types/excalidraw/element/resizeElements.d.ts +1 -2
- package/types/excalidraw/element/types.d.ts +23 -1
- package/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/types/excalidraw/scene/export.d.ts +7 -0
- package/types/excalidraw/utils.d.ts +1 -0
- package/types/excalidraw/visualdebug.d.ts +8 -1
- package/types/math/line.d.ts +19 -0
- package/types/math/point.d.ts +10 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedSceneElementsMap,
|
|
1
|
+
import type { NonDeleted, ExcalidrawLinearElement, ExcalidrawElement, PointBinding, ExcalidrawBindableElement, ExcalidrawTextElementWithContainer, ElementsMap, NonDeletedSceneElementsMap, SceneElementsMap, ExcalidrawElbowArrowElement } from "./types";
|
|
2
2
|
import type { Bounds } from "./bounds";
|
|
3
|
-
import type { AppState, PointerCoords, InteractiveCanvasAppState, AppClassProperties, NullableGridSize } from "../types";
|
|
3
|
+
import type { AppState, PointerCoords, InteractiveCanvasAppState, AppClassProperties, NullableGridSize, Zoom } from "../types";
|
|
4
4
|
import type { Store } from "../store";
|
|
5
5
|
import type Scene from "../scene/Scene";
|
|
6
6
|
import { type GlobalPoint, type LocalPoint } from "../../math";
|
|
@@ -48,7 +48,7 @@ export declare class LinearElementEditor {
|
|
|
48
48
|
* @param id the `elementId` from the instance of this class (so that we can
|
|
49
49
|
* statically guarantee this method returns an ExcalidrawLinearElement)
|
|
50
50
|
*/
|
|
51
|
-
static getElement(id: InstanceType<typeof LinearElementEditor>["elementId"], elementsMap: ElementsMap):
|
|
51
|
+
static getElement<T extends ExcalidrawLinearElement>(id: InstanceType<typeof LinearElementEditor>["elementId"], elementsMap: ElementsMap): T | null;
|
|
52
52
|
static handleBoxSelection(event: PointerEvent, appState: AppState, setState: React.Component<any, AppState>["setState"], elementsMap: NonDeletedSceneElementsMap): false | undefined;
|
|
53
53
|
/** @returns whether point was dragged */
|
|
54
54
|
static handlePointDragging(event: PointerEvent, app: AppClassProperties, scenePointerX: number, scenePointerY: number, maybeSuggestBinding: (element: NonDeleted<ExcalidrawLinearElement>, pointSceneCoords: {
|
|
@@ -62,7 +62,7 @@ export declare class LinearElementEditor {
|
|
|
62
62
|
x: number;
|
|
63
63
|
y: number;
|
|
64
64
|
}, appState: AppState, elementsMap: ElementsMap) => GlobalPoint | null;
|
|
65
|
-
static isSegmentTooShort(element: NonDeleted<ExcalidrawLinearElement>, startPoint:
|
|
65
|
+
static isSegmentTooShort<P extends GlobalPoint | LocalPoint>(element: NonDeleted<ExcalidrawLinearElement>, startPoint: P, endPoint: P, index: number, zoom: Zoom): boolean;
|
|
66
66
|
static getSegmentMidPoint(element: NonDeleted<ExcalidrawLinearElement>, startPoint: GlobalPoint, endPoint: GlobalPoint, endPointIndex: number, elementsMap: ElementsMap): GlobalPoint;
|
|
67
67
|
static getSegmentMidPointIndex(linearElementEditor: LinearElementEditor, appState: AppState, midPoint: GlobalPoint, elementsMap: ElementsMap): number;
|
|
68
68
|
static handlePointerDown(event: React.PointerEvent<HTMLElement>, app: AppClassProperties, store: Store, scenePointer: {
|
|
@@ -96,21 +96,17 @@ export declare class LinearElementEditor {
|
|
|
96
96
|
};
|
|
97
97
|
static normalizePoints(element: NonDeleted<ExcalidrawLinearElement>): void;
|
|
98
98
|
static duplicateSelectedPoints(appState: AppState, elementsMap: NonDeletedSceneElementsMap | SceneElementsMap): AppState;
|
|
99
|
-
static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]
|
|
99
|
+
static deletePoints(element: NonDeleted<ExcalidrawLinearElement>, pointIndices: readonly number[]): void;
|
|
100
100
|
static addPoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
|
|
101
101
|
point: LocalPoint;
|
|
102
|
-
}[]
|
|
102
|
+
}[]): void;
|
|
103
103
|
static movePoints(element: NonDeleted<ExcalidrawLinearElement>, targetPoints: {
|
|
104
104
|
index: number;
|
|
105
105
|
point: LocalPoint;
|
|
106
106
|
isDragging?: boolean;
|
|
107
|
-
}[],
|
|
107
|
+
}[], otherUpdates?: {
|
|
108
108
|
startBinding?: PointBinding | null;
|
|
109
109
|
endBinding?: PointBinding | null;
|
|
110
|
-
}, options?: {
|
|
111
|
-
changedElements?: Map<string, OrderedExcalidrawElement>;
|
|
112
|
-
isDragging?: boolean;
|
|
113
|
-
zoom?: AppState["zoom"];
|
|
114
110
|
}): void;
|
|
115
111
|
static shouldAddMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, appState: AppState, elementsMap: ElementsMap): boolean;
|
|
116
112
|
static addMidpoint(linearElementEditor: LinearElementEditor, pointerCoords: PointerCoords, app: AppClassProperties, snapToGrid: boolean, elementsMap: ElementsMap): {
|
|
@@ -125,5 +121,7 @@ export declare class LinearElementEditor {
|
|
|
125
121
|
};
|
|
126
122
|
static getMinMaxXYWithBoundText: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, elementBounds: Bounds, boundTextElement: ExcalidrawTextElementWithContainer) => [number, number, number, number, number, number];
|
|
127
123
|
static getElementAbsoluteCoords: (element: ExcalidrawLinearElement, elementsMap: ElementsMap, includeBoundText?: boolean) => [number, number, number, number, number, number];
|
|
124
|
+
static moveFixedSegment(linearElement: LinearElementEditor, index: number, x: number, y: number, elementsMap: ElementsMap): LinearElementEditor;
|
|
125
|
+
static deleteFixedSegment(element: ExcalidrawElbowArrowElement, index: number): void;
|
|
128
126
|
}
|
|
129
127
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ExcalidrawElement } from "./types";
|
|
2
2
|
import type { Mutable } from "../utility-types";
|
|
3
3
|
export type ElementUpdate<TElement extends ExcalidrawElement> = Omit<Partial<TElement>, "id" | "version" | "versionNonce" | "updated">;
|
|
4
|
-
export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean
|
|
4
|
+
export declare const mutateElement: <TElement extends Mutable<ExcalidrawElement>>(element: TElement, updates: ElementUpdate<TElement>, informMutation?: boolean, options?: {
|
|
5
|
+
isDragging?: boolean;
|
|
6
|
+
}) => TElement;
|
|
5
7
|
export declare const newElementWith: <TElement extends ExcalidrawElement>(element: TElement, updates: ElementUpdate<TElement>, force?: boolean) => TElement;
|
|
6
8
|
/**
|
|
7
9
|
* Mutates element, bumping `version`, `versionNonce`, and `updated`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement, ElementsMap, ExcalidrawArrowElement } from "./types";
|
|
1
|
+
import type { ExcalidrawElement, ExcalidrawImageElement, ExcalidrawTextElement, ExcalidrawLinearElement, ExcalidrawGenericElement, NonDeleted, TextAlign, GroupId, VerticalAlign, Arrowhead, ExcalidrawFreeDrawElement, FontFamilyValues, ExcalidrawTextContainer, ExcalidrawFrameElement, ExcalidrawEmbeddableElement, ExcalidrawMagicFrameElement, ExcalidrawIframeElement, ElementsMap, ExcalidrawArrowElement, FixedSegment, ExcalidrawElbowArrowElement } from "./types";
|
|
2
2
|
import type { AppState } from "../types";
|
|
3
3
|
import type { MarkOptional, Mutable } from "../utility-types";
|
|
4
4
|
export type ElementConstructorOpts = MarkOptional<Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">, "width" | "height" | "angle" | "groupIds" | "frameId" | "index" | "boundElements" | "seed" | "version" | "versionNonce" | "link" | "strokeStyle" | "fillStyle" | "strokeColor" | "backgroundColor" | "roughness" | "strokeWidth" | "roundness" | "locked" | "opacity" | "customData">;
|
|
@@ -46,13 +46,14 @@ export declare const newLinearElement: (opts: {
|
|
|
46
46
|
type: ExcalidrawLinearElement["type"];
|
|
47
47
|
points?: ExcalidrawLinearElement["points"];
|
|
48
48
|
} & ElementConstructorOpts) => NonDeleted<ExcalidrawLinearElement>;
|
|
49
|
-
export declare const newArrowElement: (opts: {
|
|
49
|
+
export declare const newArrowElement: <T extends boolean>(opts: {
|
|
50
50
|
type: ExcalidrawArrowElement["type"];
|
|
51
|
-
startArrowhead?: Arrowhead | null;
|
|
52
|
-
endArrowhead?: Arrowhead | null;
|
|
53
|
-
points?:
|
|
54
|
-
elbowed?:
|
|
55
|
-
|
|
51
|
+
startArrowhead?: Arrowhead | null | undefined;
|
|
52
|
+
endArrowhead?: Arrowhead | null | undefined;
|
|
53
|
+
points?: readonly import("../../math").LocalPoint[] | undefined;
|
|
54
|
+
elbowed?: T | undefined;
|
|
55
|
+
fixedSegments?: FixedSegment[] | null | undefined;
|
|
56
|
+
} & Omit<Omit<ExcalidrawGenericElement, "id" | "isDeleted" | "updated" | "type">, "angle" | "link" | "width" | "height" | "backgroundColor" | "strokeColor" | "fillStyle" | "strokeWidth" | "strokeStyle" | "roundness" | "roughness" | "opacity" | "seed" | "version" | "versionNonce" | "index" | "groupIds" | "frameId" | "boundElements" | "locked" | "customData"> & Partial<Pick<Omit<ExcalidrawGenericElement, "id" | "isDeleted" | "updated" | "type">, "angle" | "link" | "width" | "height" | "backgroundColor" | "strokeColor" | "fillStyle" | "strokeWidth" | "strokeStyle" | "roundness" | "roughness" | "opacity" | "seed" | "version" | "versionNonce" | "index" | "groupIds" | "frameId" | "boundElements" | "locked" | "customData">>) => T extends true ? NonDeleted<ExcalidrawElbowArrowElement> : NonDeleted<ExcalidrawArrowElement>;
|
|
56
57
|
export declare const newImageElement: (opts: {
|
|
57
58
|
type: ExcalidrawImageElement["type"];
|
|
58
59
|
status?: ExcalidrawImageElement["status"];
|
|
@@ -27,13 +27,12 @@ export declare const getNextSingleWidthAndHeightFromPointer: (latestElement: Exc
|
|
|
27
27
|
nextWidth: number;
|
|
28
28
|
nextHeight: number;
|
|
29
29
|
};
|
|
30
|
-
export declare const resizeMultipleElements: (selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, handleDirection: TransformHandleDirection, scene: Scene, { shouldMaintainAspectRatio, shouldResizeFromCenter, flipByX, flipByY, nextHeight, nextWidth,
|
|
30
|
+
export declare const resizeMultipleElements: (selectedElements: readonly NonDeletedExcalidrawElement[], elementsMap: ElementsMap, handleDirection: TransformHandleDirection, scene: Scene, originalElementsMap: ElementsMap, { shouldMaintainAspectRatio, shouldResizeFromCenter, flipByX, flipByY, nextHeight, nextWidth, originalBoundingBox, }?: {
|
|
31
31
|
nextWidth?: number | undefined;
|
|
32
32
|
nextHeight?: number | undefined;
|
|
33
33
|
shouldMaintainAspectRatio?: boolean | undefined;
|
|
34
34
|
shouldResizeFromCenter?: boolean | undefined;
|
|
35
35
|
flipByX?: boolean | undefined;
|
|
36
36
|
flipByY?: boolean | undefined;
|
|
37
|
-
originalElementsMap?: ElementsMap | undefined;
|
|
38
37
|
originalBoundingBox?: BoundingBox | undefined;
|
|
39
38
|
}) => void;
|
|
@@ -208,7 +208,7 @@ export type PointBinding = {
|
|
|
208
208
|
export type FixedPointBinding = Merge<PointBinding, {
|
|
209
209
|
fixedPoint: FixedPoint;
|
|
210
210
|
}>;
|
|
211
|
-
export type Arrowhead = "arrow" | "bar" | "dot" | "circle" | "circle_outline" | "triangle" | "triangle_outline" | "diamond" | "diamond_outline";
|
|
211
|
+
export type Arrowhead = "arrow" | "bar" | "dot" | "circle" | "circle_outline" | "triangle" | "triangle_outline" | "diamond" | "diamond_outline" | "crowfoot_one" | "crowfoot_many" | "crowfoot_one_or_many";
|
|
212
212
|
export type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<{
|
|
213
213
|
type: "line" | "arrow";
|
|
214
214
|
points: readonly LocalPoint[];
|
|
@@ -218,6 +218,11 @@ export type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<{
|
|
|
218
218
|
startArrowhead: Arrowhead | null;
|
|
219
219
|
endArrowhead: Arrowhead | null;
|
|
220
220
|
}>;
|
|
221
|
+
export type FixedSegment = {
|
|
222
|
+
start: LocalPoint;
|
|
223
|
+
end: LocalPoint;
|
|
224
|
+
index: number;
|
|
225
|
+
};
|
|
221
226
|
export type ExcalidrawArrowElement = ExcalidrawLinearElement & Readonly<{
|
|
222
227
|
type: "arrow";
|
|
223
228
|
elbowed: boolean;
|
|
@@ -226,6 +231,23 @@ export type ExcalidrawElbowArrowElement = Merge<ExcalidrawArrowElement, {
|
|
|
226
231
|
elbowed: true;
|
|
227
232
|
startBinding: FixedPointBinding | null;
|
|
228
233
|
endBinding: FixedPointBinding | null;
|
|
234
|
+
fixedSegments: FixedSegment[] | null;
|
|
235
|
+
/**
|
|
236
|
+
* Marks that the 3rd point should be used as the 2nd point of the arrow in
|
|
237
|
+
* order to temporarily hide the first segment of the arrow without losing
|
|
238
|
+
* the data from the points array. It allows creating the expected arrow
|
|
239
|
+
* path when the arrow with fixed segments is bound on a horizontal side and
|
|
240
|
+
* moved to a vertical and vica versa.
|
|
241
|
+
*/
|
|
242
|
+
startIsSpecial: boolean | null;
|
|
243
|
+
/**
|
|
244
|
+
* Marks that the 3rd point backwards from the end should be used as the 2nd
|
|
245
|
+
* point of the arrow in order to temporarily hide the last segment of the
|
|
246
|
+
* arrow without losing the data from the points array. It allows creating
|
|
247
|
+
* the expected arrow path when the arrow with fixed segments is bound on a
|
|
248
|
+
* horizontal side and moved to a vertical and vica versa.
|
|
249
|
+
*/
|
|
250
|
+
endIsSpecial: boolean | null;
|
|
229
251
|
}>;
|
|
230
252
|
export type ExcalidrawFreeDrawElement = _ExcalidrawElementBase & Readonly<{
|
|
231
253
|
type: "freedraw";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LibraryItem } from "../types";
|
|
2
2
|
export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>;
|
|
3
|
-
export declare const libraryItemSvgsCache: import("jotai").PrimitiveAtom<SvgCache> & {
|
|
3
|
+
export declare const libraryItemSvgsCache: import("jotai/vanilla/atom").PrimitiveAtom<SvgCache> & {
|
|
4
4
|
init: SvgCache;
|
|
5
5
|
};
|
|
6
6
|
export declare const useLibraryItemSvg: (id: LibraryItem["id"] | null, elements: LibraryItem["elements"] | undefined, svgCache: SvgCache) => SVGSVGElement | undefined;
|
|
@@ -27,4 +27,11 @@ export declare const exportToSvg: (elements: readonly NonDeletedExcalidrawElemen
|
|
|
27
27
|
skipInliningFonts?: true;
|
|
28
28
|
reuseImages?: boolean;
|
|
29
29
|
}) => Promise<SVGSVGElement>;
|
|
30
|
+
export declare const encodeSvgBase64Payload: ({ payload, metadataElement, }: {
|
|
31
|
+
payload: string;
|
|
32
|
+
metadataElement: SVGMetadataElement;
|
|
33
|
+
}) => void;
|
|
34
|
+
export declare const decodeSvgBase64Payload: ({ svg }: {
|
|
35
|
+
svg: string;
|
|
36
|
+
}) => string;
|
|
30
37
|
export declare const getExportSize: (elements: readonly NonDeletedExcalidrawElement[], exportPadding: number, scale: number) => [number, number];
|
|
@@ -246,4 +246,5 @@ export declare class PromisePool<T> {
|
|
|
246
246
|
constructor(source: IterableIterator<Promise<void | readonly [number, T]>>, concurrency: number);
|
|
247
247
|
all(): PromiseLike<T[]>;
|
|
248
248
|
}
|
|
249
|
+
export declare const sanitizeHTMLAttribute: (html: string) => string;
|
|
249
250
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type GlobalPoint } from "../math";
|
|
1
|
+
import { type GlobalPoint, type LocalPoint } from "../math";
|
|
2
2
|
import type { LineSegment } from "../utils";
|
|
3
3
|
import type { BoundingBox, Bounds } from "./element/bounds";
|
|
4
4
|
declare global {
|
|
@@ -7,6 +7,8 @@ declare global {
|
|
|
7
7
|
data: DebugElement[][];
|
|
8
8
|
currentFrame?: number;
|
|
9
9
|
};
|
|
10
|
+
debugDrawPoint: typeof debugDrawPoint;
|
|
11
|
+
debugDrawLine: typeof debugDrawLine;
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
export type DebugElement = {
|
|
@@ -31,5 +33,10 @@ export declare const debugDrawBounds: (box: Bounds | Bounds[], opts?: {
|
|
|
31
33
|
color?: string;
|
|
32
34
|
permanent?: boolean;
|
|
33
35
|
}) => void;
|
|
36
|
+
export declare const debugDrawPoints: ({ x, y, points, }: {
|
|
37
|
+
x: number;
|
|
38
|
+
y: number;
|
|
39
|
+
points: LocalPoint[];
|
|
40
|
+
}, options?: any) => void;
|
|
34
41
|
export declare const debugCloseFrame: () => void;
|
|
35
42
|
export declare const debugClear: () => void;
|
package/types/math/line.d.ts
CHANGED
|
@@ -23,4 +23,23 @@ export declare function lineFromPointPair<P extends GlobalPoint | LocalPoint>([a
|
|
|
23
23
|
* @returns
|
|
24
24
|
*/
|
|
25
25
|
export declare function lineFromPointArray<P extends GlobalPoint | LocalPoint>(pointArray: P[]): Line<P> | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Return the coordinates resulting from rotating the given line about an
|
|
28
|
+
* origin by an angle in degrees note that when the origin is not given,
|
|
29
|
+
* the midpoint of the given line is used as the origin
|
|
30
|
+
*
|
|
31
|
+
* @param l
|
|
32
|
+
* @param angle
|
|
33
|
+
* @param origin
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
26
36
|
export declare const lineRotate: <Point extends GlobalPoint | LocalPoint>(l: Line<Point>, angle: Radians, origin?: Point | undefined) => Line<Point>;
|
|
37
|
+
/**
|
|
38
|
+
* Determines the intersection point (unless the lines are parallel) of two
|
|
39
|
+
* lines
|
|
40
|
+
*
|
|
41
|
+
* @param a
|
|
42
|
+
* @param b
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
export declare const linesIntersectAt: <Point extends GlobalPoint | LocalPoint>(a: Line<Point>, b: Line<Point>) => Point | null;
|
package/types/math/point.d.ts
CHANGED
|
@@ -28,6 +28,16 @@ export declare function pointFromPair<Point extends GlobalPoint | LocalPoint>(pa
|
|
|
28
28
|
* @returns The point the vector points at with origin 0,0
|
|
29
29
|
*/
|
|
30
30
|
export declare function pointFromVector<P extends GlobalPoint | LocalPoint>(v: Vector): P;
|
|
31
|
+
/**
|
|
32
|
+
* Convert the coordiante object to a point.
|
|
33
|
+
*
|
|
34
|
+
* @param coords The coordinate object with x and y properties
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
export declare function pointFromCoords<Point extends GlobalPoint | LocalPoint>({ x, y, }: {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
}): Point;
|
|
31
41
|
/**
|
|
32
42
|
* Checks if the provided value has the shape of a Point.
|
|
33
43
|
*
|