@plait/draw 0.1.0-next.7 → 0.1.0-next.9
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/esm2022/constants/geometry.mjs +4 -3
- package/esm2022/generators/geometry-shape.generator.mjs +4 -3
- package/esm2022/generators/line.generator.mjs +3 -26
- package/esm2022/geometry.component.mjs +18 -9
- package/esm2022/interfaces/geometry.mjs +5 -2
- package/esm2022/interfaces/line.mjs +9 -1
- package/esm2022/plugins/with-draw.mjs +2 -2
- package/esm2022/plugins/with-geometry-create.mjs +4 -5
- package/esm2022/plugins/with-geometry-resize.mjs +5 -5
- package/esm2022/plugins/with-line-bound-reaction.mjs +5 -7
- package/esm2022/plugins/with-line-create.mjs +3 -3
- package/esm2022/public-api.mjs +2 -1
- package/esm2022/transforms/index.mjs +4 -3
- package/esm2022/transforms/line.mjs +8 -1
- package/esm2022/utils/geometry.mjs +8 -8
- package/esm2022/utils/line-arrow.mjs +89 -0
- package/esm2022/utils/line.mjs +41 -41
- package/esm2022/utils/style/stroke.mjs +5 -2
- package/fesm2022/plait-draw.mjs +184 -94
- package/fesm2022/plait-draw.mjs.map +1 -1
- package/geometry.component.d.ts +4 -4
- package/interfaces/geometry.d.ts +1 -0
- package/interfaces/line.d.ts +8 -1
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/transforms/index.d.ts +1 -0
- package/transforms/line.d.ts +2 -1
- package/utils/geometry.d.ts +1 -1
- package/utils/line-arrow.d.ts +4 -0
- package/utils/line.d.ts +0 -2
package/geometry.component.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ChangeDetectorRef, OnDestroy, OnInit, ViewContainerRef } from '@angular/core';
|
|
2
|
-
import { PlaitBoard,
|
|
2
|
+
import { PlaitBoard, PlaitPluginElementContext, OnContextChanged } from '@plait/core';
|
|
3
3
|
import { Subject } from 'rxjs';
|
|
4
4
|
import { PlaitGeometry } from './interfaces/geometry';
|
|
5
5
|
import { GeometryShapeGenerator } from './generators/geometry-shape.generator';
|
|
6
6
|
import { TextManage } from '@plait/text';
|
|
7
|
-
import { ActiveGenerator } from '@plait/common';
|
|
7
|
+
import { ActiveGenerator, CommonPluginElement } from '@plait/common';
|
|
8
8
|
import * as i0 from "@angular/core";
|
|
9
|
-
export declare class GeometryComponent extends
|
|
9
|
+
export declare class GeometryComponent extends CommonPluginElement<PlaitGeometry, PlaitBoard> implements OnInit, OnDestroy, OnContextChanged<PlaitGeometry, PlaitBoard> {
|
|
10
10
|
private viewContainerRef;
|
|
11
11
|
protected cdr: ChangeDetectorRef;
|
|
12
12
|
destroy$: Subject<void>;
|
|
13
13
|
activeGenerator: ActiveGenerator<PlaitGeometry>;
|
|
14
14
|
shapeGenerator: GeometryShapeGenerator;
|
|
15
|
-
textManage: TextManage;
|
|
15
|
+
get textManage(): TextManage;
|
|
16
16
|
constructor(viewContainerRef: ViewContainerRef, cdr: ChangeDetectorRef);
|
|
17
17
|
initializeGenerator(): void;
|
|
18
18
|
ngOnInit(): void;
|
package/interfaces/geometry.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export interface PlaitDiamond extends PlaitGeometry {
|
|
|
34
34
|
}
|
|
35
35
|
export declare const PlaitGeometry: {
|
|
36
36
|
getTextEditor(element: PlaitGeometry): import("slate").BaseEditor & import("slate-angular").AngularEditor & import("slate-history").HistoryEditor;
|
|
37
|
+
getTextManage(element: PlaitGeometry): import("@plait/text").TextManage;
|
|
37
38
|
};
|
|
38
39
|
export interface ShapeEngine {
|
|
39
40
|
isHit: (rectangle: RectangleClient, point: Point) => boolean;
|
package/interfaces/line.d.ts
CHANGED
|
@@ -4,13 +4,20 @@ import { PlaitGeometry } from './geometry';
|
|
|
4
4
|
import { StrokeStyle } from './element';
|
|
5
5
|
export declare enum LineMarkerType {
|
|
6
6
|
arrow = "arrow",
|
|
7
|
-
none = "none"
|
|
7
|
+
none = "none",
|
|
8
|
+
openTriangle = "open-triangle",
|
|
9
|
+
solidTriangle = "solid-triangle",
|
|
10
|
+
sharpArrow = "sharp-arrow"
|
|
8
11
|
}
|
|
9
12
|
export declare enum LineShape {
|
|
10
13
|
straight = "straight",
|
|
11
14
|
curve = "curve",
|
|
12
15
|
elbow = "elbow"
|
|
13
16
|
}
|
|
17
|
+
export declare enum LineHandleKey {
|
|
18
|
+
source = "source",
|
|
19
|
+
target = "target"
|
|
20
|
+
}
|
|
14
21
|
export interface LineText {
|
|
15
22
|
text: Element;
|
|
16
23
|
position: number;
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
package/transforms/index.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export declare const DrawTransforms: {
|
|
|
7
7
|
resizeLine: (board: import("@plait/core").PlaitBoard, options: Partial<import("@plait/draw").PlaitLine>, path: import("@plait/core").Path) => void;
|
|
8
8
|
setLineTexts: (board: import("@plait/core").PlaitBoard, element: import("@plait/draw").PlaitLine, texts: import("@plait/draw").LineText[]) => void;
|
|
9
9
|
removeLineText: (board: import("@plait/core").PlaitBoard, element: import("@plait/draw").PlaitLine, index: number) => void;
|
|
10
|
+
setLineMark: (board: import("@plait/core").PlaitBoard, element: import("@plait/draw").PlaitLine, handleKey: import("@plait/draw").LineHandleKey, marker: import("@plait/draw").LineMarkerType) => void;
|
|
10
11
|
};
|
package/transforms/line.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Path, PlaitBoard } from '@plait/core';
|
|
2
|
-
import { LineText, PlaitLine } from '../interfaces';
|
|
2
|
+
import { LineHandleKey, LineMarkerType, LineText, PlaitLine } from '../interfaces';
|
|
3
3
|
export declare const resizeLine: (board: PlaitBoard, options: Partial<PlaitLine>, path: Path) => void;
|
|
4
4
|
export declare const setLineTexts: (board: PlaitBoard, element: PlaitLine, texts: LineText[]) => void;
|
|
5
5
|
export declare const removeLineText: (board: PlaitBoard, element: PlaitLine, index: number) => void;
|
|
6
|
+
export declare const setLineMark: (board: PlaitBoard, element: PlaitLine, handleKey: LineHandleKey, marker: LineMarkerType) => void;
|
package/utils/geometry.d.ts
CHANGED
|
@@ -12,5 +12,5 @@ export declare const getTextRectangle: (element: PlaitGeometry) => {
|
|
|
12
12
|
};
|
|
13
13
|
export declare const drawBoundMask: (board: PlaitBoard, element: PlaitGeometry) => SVGGElement;
|
|
14
14
|
export declare const drawGeometry: (board: PlaitBoard, outerRectangle: RectangleClient, shape: GeometryShape, options: Options) => SVGGElement;
|
|
15
|
-
export declare const getNearestPoint: (element: PlaitGeometry, point: Point,
|
|
15
|
+
export declare const getNearestPoint: (element: PlaitGeometry, point: Point, inflateDelta?: number) => Point;
|
|
16
16
|
export declare const getCenterPointsOnPolygon: (points: Point[]) => Point[];
|
package/utils/line.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Point, PlaitBoard, RectangleClient } from '@plait/core';
|
|
2
2
|
import { LineHandle, LineShape, PlaitGeometry, PlaitLine } from '../interfaces';
|
|
3
|
-
import { Options } from 'roughjs/bin/core';
|
|
4
3
|
export declare const createLineElement: (shape: LineShape, points: [Point, Point], source: LineHandle, target: LineHandle, options?: Pick<PlaitLine, 'strokeColor' | 'strokeWidth'>) => PlaitLine;
|
|
5
4
|
export declare const getLinePoints: (board: PlaitBoard, element: PlaitLine) => Point[];
|
|
6
5
|
export declare const getStraightPoints: (board: PlaitBoard, element: PlaitLine) => Point[];
|
|
@@ -9,7 +8,6 @@ export declare const isHitPolyLine: (pathPoints: Point[], point: Point, strokeWi
|
|
|
9
8
|
export declare const getHitLineTextIndex: (board: PlaitBoard, element: PlaitLine, point: Point) => number;
|
|
10
9
|
export declare const isHitLineText: (board: PlaitBoard, element: PlaitLine, point: Point) => boolean;
|
|
11
10
|
export declare const drawLine: (board: PlaitBoard, element: PlaitLine) => SVGGElement;
|
|
12
|
-
export declare const drawLineArrow: (element: PlaitLine, points: Point[], options: Options) => SVGGElement | null;
|
|
13
11
|
export declare const getSourcePoint: (board: PlaitBoard, element: PlaitLine) => Point;
|
|
14
12
|
export declare const getTargetPoint: (board: PlaitBoard, element: PlaitLine) => Point;
|
|
15
13
|
export declare const getConnectionPoint: (geometry: PlaitGeometry, connection: Point, offset: number) => Point;
|