@plait/core 0.39.0 → 0.40.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/board/board.component.d.ts +2 -2
- package/esm2022/board/board.component.mjs +6 -4
- package/esm2022/interfaces/board.mjs +1 -1
- package/esm2022/interfaces/rectangle-client.mjs +3 -3
- package/esm2022/plugins/create-board.mjs +4 -2
- package/esm2022/plugins/with-board.mjs +10 -3
- package/esm2022/plugins/with-selection.mjs +55 -48
- package/esm2022/utils/common.mjs +4 -2
- package/esm2022/utils/dom/common.mjs +21 -3
- package/esm2022/utils/math.mjs +4 -2
- package/esm2022/utils/to-image.mjs +6 -6
- package/esm2022/utils/viewport.mjs +14 -7
- package/esm2022/utils/weak-maps.mjs +2 -1
- package/fesm2022/plait-core.mjs +116 -69
- package/fesm2022/plait-core.mjs.map +1 -1
- package/interfaces/board.d.ts +1 -0
- package/package.json +1 -1
- package/plugins/with-selection.d.ts +2 -0
- package/utils/dom/common.d.ts +15 -2
- package/utils/math.d.ts +1 -1
- package/utils/viewport.d.ts +1 -0
- package/utils/weak-maps.d.ts +1 -0
package/interfaces/board.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export interface PlaitBoard {
|
|
|
27
27
|
redo: () => void;
|
|
28
28
|
apply: (operation: PlaitOperation) => void;
|
|
29
29
|
onChange: () => void;
|
|
30
|
+
afterChange: () => void;
|
|
30
31
|
mousedown: (event: MouseEvent) => void;
|
|
31
32
|
mousemove: (event: MouseEvent) => void;
|
|
32
33
|
mouseleave: (event: MouseEvent) => void;
|
package/package.json
CHANGED
|
@@ -6,6 +6,8 @@ export interface WithPluginOptions extends PlaitPluginOptions {
|
|
|
6
6
|
isDisabledSelect: boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare function withSelection(board: PlaitBoard): PlaitBoard;
|
|
9
|
+
export declare function isHandleSelection(board: PlaitBoard): boolean;
|
|
10
|
+
export declare function isSetSelectionOperation(board: PlaitBoard): boolean;
|
|
9
11
|
export declare function getTemporaryElements(board: PlaitBoard): PlaitElement[] | undefined;
|
|
10
12
|
export declare function getTemporaryRef(board: PlaitBoard): {
|
|
11
13
|
elements: PlaitElement[];
|
package/utils/dom/common.d.ts
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { Options } from 'roughjs/bin/core';
|
|
2
|
-
import { RectangleClient } from '../../interfaces';
|
|
2
|
+
import { PlaitBoard, RectangleClient } from '../../interfaces';
|
|
3
3
|
import { Point } from '../../interfaces/point';
|
|
4
4
|
export declare const NS = "http://www.w3.org/2000/svg";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Get the screen coordinates starting from the upper left corner of the svg element (based on the svg screen coordinate system)
|
|
7
|
+
* @param x screen x
|
|
8
|
+
* @param y screen x
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export declare function toPoint(x: number, y: number, svg: SVGElement): Point;
|
|
12
|
+
/**
|
|
13
|
+
* `toPoint` reverse processing
|
|
14
|
+
* Get the screen coordinate starting from the upper left corner of the browser window (based on the screen coordinate system)
|
|
15
|
+
* @param point screen coordinates based on the upper left corner of the svg
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export declare function toScreenPoint(board: PlaitBoard, point: Point): Point;
|
|
6
19
|
export declare function createG(): SVGGElement;
|
|
7
20
|
export declare function createPath(): SVGPathElement;
|
|
8
21
|
export declare function createRect(rectangle: RectangleClient, options?: Options): SVGRectElement;
|
package/utils/math.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { RectangleClient } from '../interfaces/rectangle-client';
|
|
|
3
3
|
export declare function distanceBetweenPointAndSegment(x: number, y: number, x1: number, y1: number, x2: number, y2: number): number;
|
|
4
4
|
export declare function getNearestPointBetweenPointAndSegment(point: Point, linePoints: [Point, Point]): Point;
|
|
5
5
|
export declare function distanceBetweenPointAndSegments(points: Point[], point: Point): number;
|
|
6
|
-
export declare function getNearestPointBetweenPointAndSegments(point: Point, points: Point[]): Point;
|
|
6
|
+
export declare function getNearestPointBetweenPointAndSegments(point: Point, points: Point[], isClose?: Boolean): Point;
|
|
7
7
|
export declare function rotate(x1: number, y1: number, x2: number, y2: number, angle: number): number[];
|
|
8
8
|
export declare function distanceBetweenPointAndPoint(x1: number, y1: number, x2: number, y2: number): number;
|
|
9
9
|
export declare function distanceBetweenPointAndRectangle(x: number, y: number, rect: RectangleClient): number;
|
package/utils/viewport.d.ts
CHANGED
package/utils/weak-maps.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const NODE_TO_INDEX: WeakMap<PlaitElement, number>;
|
|
|
11
11
|
export declare const NODE_TO_PARENT: WeakMap<PlaitElement, Ancestor>;
|
|
12
12
|
export declare const IS_TEXT_EDITABLE: WeakMap<PlaitBoard, boolean>;
|
|
13
13
|
export declare const BOARD_TO_ON_CHANGE: WeakMap<PlaitBoard, () => void>;
|
|
14
|
+
export declare const BOARD_TO_AFTER_CHANGE: WeakMap<PlaitBoard, () => void>;
|
|
14
15
|
export declare const BOARD_TO_COMPONENT: WeakMap<PlaitBoard, BoardComponentInterface>;
|
|
15
16
|
export declare const BOARD_TO_ROUGH_SVG: WeakMap<PlaitBoard, RoughSVG>;
|
|
16
17
|
export declare const BOARD_TO_HOST: WeakMap<PlaitBoard, SVGSVGElement>;
|