@plait/core 0.48.0 → 0.49.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/board/board.component.mjs +3 -3
- package/esm2022/plugins/with-moving.mjs +6 -9
- package/esm2022/plugins/with-selection.mjs +7 -8
- package/esm2022/transforms/board.mjs +4 -5
- package/esm2022/utils/board.mjs +1 -15
- package/esm2022/utils/dom/common.mjs +1 -23
- package/esm2022/utils/index.mjs +2 -1
- package/esm2022/utils/to-point.mjs +49 -0
- package/esm2022/utils/viewport.mjs +8 -20
- package/fesm2022/plait-core.mjs +64 -66
- package/fesm2022/plait-core.mjs.map +1 -1
- package/package.json +1 -1
- package/utils/board.d.ts +0 -3
- package/utils/dom/common.d.ts +1 -16
- package/utils/index.d.ts +1 -0
- package/utils/to-point.d.ts +21 -0
- package/utils/viewport.d.ts +2 -7
package/package.json
CHANGED
package/utils/board.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PlaitBoard } from '../interfaces/board';
|
|
2
|
-
import { Point } from '../interfaces/point';
|
|
3
2
|
export type ViewBox = {
|
|
4
3
|
minX: number;
|
|
5
4
|
minY: number;
|
|
@@ -8,7 +7,5 @@ export type ViewBox = {
|
|
|
8
7
|
viewportWidth: number;
|
|
9
8
|
viewportHeight: number;
|
|
10
9
|
};
|
|
11
|
-
export declare function transformPoints(board: PlaitBoard, points: Point[]): Point[];
|
|
12
|
-
export declare function transformPoint(board: PlaitBoard, point: Point): Point;
|
|
13
10
|
export declare function isInPlaitBoard(board: PlaitBoard, x: number, y: number): boolean;
|
|
14
11
|
export declare function getRealScrollBarWidth(board: PlaitBoard): number;
|
package/utils/dom/common.d.ts
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import { Options } from 'roughjs/bin/core';
|
|
2
|
-
import {
|
|
3
|
-
import { Point } from '../../interfaces/point';
|
|
2
|
+
import { RectangleClient } from '../../interfaces';
|
|
4
3
|
export declare const NS = "http://www.w3.org/2000/svg";
|
|
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;
|
|
19
4
|
export declare function createG(): SVGGElement;
|
|
20
5
|
export declare function createPath(): SVGPathElement;
|
|
21
6
|
export declare function createRect(rectangle: RectangleClient, options?: Options): SVGRectElement;
|
package/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PlaitBoard } from '../interfaces/board';
|
|
2
|
+
import { Point } from '../interfaces/point';
|
|
3
|
+
export declare const getViewBox: (board: PlaitBoard) => DOMRect;
|
|
4
|
+
/**
|
|
5
|
+
* Get the screen point starting from the upper left corner of the svg element (based on the svg screen coordinate system)
|
|
6
|
+
*/
|
|
7
|
+
export declare function toHostPoint(board: PlaitBoard, x: number, y: number): Point;
|
|
8
|
+
/**
|
|
9
|
+
* Get the point in the coordinate system of the svg viewBox
|
|
10
|
+
*/
|
|
11
|
+
export declare function toViewBoxPoint(board: PlaitBoard, hostPoint: Point): Point;
|
|
12
|
+
export declare function toViewBoxPoints(board: PlaitBoard, hostPoints: Point[]): Point[];
|
|
13
|
+
/**
|
|
14
|
+
* `toHostPoint` reverse processing
|
|
15
|
+
* Get the screen point starting from the upper left corner of the browser window or the viewport (based on the screen coordinate system)
|
|
16
|
+
*/
|
|
17
|
+
export declare function toScreenPointFromHostPoint(board: PlaitBoard, hostPoint: Point): Point;
|
|
18
|
+
/**
|
|
19
|
+
* `toViewBoxPoint` reverse processing
|
|
20
|
+
*/
|
|
21
|
+
export declare function toHostPointFromViewBoxPoint(board: PlaitBoard, viewBoxPoint: Point): Point;
|
package/utils/viewport.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { PlaitBoard, Point, RectangleClient } from '../interfaces';
|
|
2
|
-
export declare function toSVGScreenPoint(board: PlaitBoard, point: Point): Point;
|
|
3
2
|
export declare function getViewportContainerRect(board: PlaitBoard): {
|
|
4
3
|
width: number;
|
|
5
4
|
height: number;
|
|
@@ -11,14 +10,10 @@ export declare function getElementHostBBox(board: PlaitBoard, zoom: number): {
|
|
|
11
10
|
bottom: number;
|
|
12
11
|
};
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param zoom 缩放比
|
|
16
|
-
* @param minZoom 最小缩放比
|
|
17
|
-
* @param maxZoom 最大缩放比
|
|
18
|
-
* @returns 正确的缩放比
|
|
13
|
+
* Normalize the scaling ratio, or return the corrected scaling ratio if the limit is exceeded
|
|
19
14
|
*/
|
|
20
15
|
export declare function clampZoomLevel(zoom: number, minZoom?: number, maxZoom?: number): number;
|
|
21
|
-
export declare function
|
|
16
|
+
export declare function calcNewViewBox(board: PlaitBoard, zoom: number): number[];
|
|
22
17
|
export declare function getViewBoxCenterPoint(board: PlaitBoard): Point;
|
|
23
18
|
export declare function setSVGViewBox(board: PlaitBoard, viewBox: number[]): void;
|
|
24
19
|
export declare function updateViewportOffset(board: PlaitBoard): void;
|