@plait/draw 0.37.0 → 0.38.0
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/plugins/with-geometry-create.mjs +20 -32
- package/esm2022/transforms/geometry.mjs +3 -3
- package/esm2022/utils/geometry.mjs +29 -11
- package/esm2022/utils/memorize.mjs +2 -2
- package/fesm2022/plait-draw.mjs +227 -220
- package/fesm2022/plait-draw.mjs.map +1 -1
- package/package.json +1 -1
- package/plugins/with-geometry-create.d.ts +1 -7
- package/utils/geometry.d.ts +10 -2
package/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { PlaitBoard
|
|
2
|
-
import { DrawPointerType } from '../constants';
|
|
1
|
+
import { PlaitBoard } from '@plait/core';
|
|
3
2
|
import { TextManage } from '@plait/text';
|
|
4
3
|
export interface FakeCreateTextRef {
|
|
5
4
|
g: SVGGElement;
|
|
@@ -7,8 +6,3 @@ export interface FakeCreateTextRef {
|
|
|
7
6
|
}
|
|
8
7
|
export declare const withGeometryCreateByDrag: (board: PlaitBoard) => PlaitBoard;
|
|
9
8
|
export declare const withGeometryCreateByDrawing: (board: PlaitBoard) => PlaitBoard;
|
|
10
|
-
export declare const getDefaultGeometryPoints: (board: PlaitBoard, pointer: DrawPointerType, targetPoint: Point, fontSize?: number) => [Point, Point];
|
|
11
|
-
export declare const getGeometryDefaultProperty: (board: PlaitBoard, pointer: DrawPointerType, fontSize?: number) => {
|
|
12
|
-
width: number;
|
|
13
|
-
height: number;
|
|
14
|
-
};
|
package/utils/geometry.d.ts
CHANGED
|
@@ -2,13 +2,15 @@ import { PlaitBoard, Point, RectangleClient, ThemeColorMode } from '@plait/core'
|
|
|
2
2
|
import { GeometryShapes, PlaitGeometry, FlowchartSymbols } from '../interfaces/geometry';
|
|
3
3
|
import { Alignment, CustomText } from '@plait/text';
|
|
4
4
|
import { Element } from 'slate';
|
|
5
|
+
import { DrawPointerType } from '../constants';
|
|
5
6
|
import { Options } from 'roughjs/bin/core';
|
|
6
7
|
import { PlaitShape } from '../interfaces';
|
|
7
8
|
export type GeometryStyleOptions = Pick<PlaitGeometry, 'fill' | 'strokeColor' | 'strokeWidth'>;
|
|
8
9
|
export type TextProperties = Partial<CustomText> & {
|
|
9
10
|
align?: Alignment;
|
|
11
|
+
textHeight?: number;
|
|
10
12
|
};
|
|
11
|
-
export declare const createGeometryElement: (
|
|
13
|
+
export declare const createGeometryElement: (shape: GeometryShapes, points: [Point, Point], text: string | Element, options?: GeometryStyleOptions, textProperties?: TextProperties) => PlaitGeometry;
|
|
12
14
|
export declare const getPointsByCenterPoint: (point: Point, width: number, height: number) => [Point, Point];
|
|
13
15
|
export declare const getTextRectangle: (element: PlaitGeometry) => {
|
|
14
16
|
height: number;
|
|
@@ -40,7 +42,7 @@ export declare const getDefaultFlowchartProperty: (symbol: FlowchartSymbols) =>
|
|
|
40
42
|
width: number;
|
|
41
43
|
height: number;
|
|
42
44
|
};
|
|
43
|
-
export declare const createDefaultFlowchart: (
|
|
45
|
+
export declare const createDefaultFlowchart: (point: Point) => (import("../interfaces").PlaitLine | PlaitGeometry)[];
|
|
44
46
|
export declare const getAutoCompletePoints: (element: PlaitShape) => [Point, Point, Point, Point];
|
|
45
47
|
export declare const getHitIndexOfAutoCompletePoint: (movingPoint: Point, points: Point[]) => number;
|
|
46
48
|
export declare const getDrawDefaultStrokeColor: (theme: ThemeColorMode) => string;
|
|
@@ -50,3 +52,9 @@ export declare const getDefaultTextShapeProperty: (board: PlaitBoard, fontSize?:
|
|
|
50
52
|
height: number;
|
|
51
53
|
text: string;
|
|
52
54
|
};
|
|
55
|
+
export declare const getDefaultGeometryPoints: (pointer: DrawPointerType, centerPoint: Point) => [Point, Point];
|
|
56
|
+
export declare const getDefaultGeometryProperty: (pointer: DrawPointerType) => {
|
|
57
|
+
width: number;
|
|
58
|
+
height: number;
|
|
59
|
+
};
|
|
60
|
+
export declare const getDefaultTextPoints: (board: PlaitBoard, centerPoint: Point, fontSize?: number | string) => [Point, Point];
|