@plait/core 0.24.0-next.3 → 0.24.0-next.5
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-selection.mjs +7 -9
- package/esm2022/utils/dom/common.mjs +9 -1
- package/esm2022/utils/dom/foreign.mjs +9 -3
- package/esm2022/utils/draw/rectangle.mjs +9 -1
- package/esm2022/utils/math.mjs +49 -1
- package/fesm2022/plait-core.mjs +76 -10
- package/fesm2022/plait-core.mjs.map +1 -1
- package/package.json +1 -1
- package/utils/dom/common.d.ts +2 -0
- package/utils/dom/foreign.d.ts +2 -1
- package/utils/draw/rectangle.d.ts +3 -0
- package/utils/math.d.ts +3 -0
package/package.json
CHANGED
package/utils/dom/common.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export declare function toPoint(x: number, y: number, container: SVGElement): Po
|
|
|
6
6
|
export declare function createG(): SVGGElement;
|
|
7
7
|
export declare function createPath(): SVGPathElement;
|
|
8
8
|
export declare function createRect(rectangle: RectangleClient, options?: Options): SVGRectElement;
|
|
9
|
+
export declare const setStrokeLinecap: (g: SVGGElement, value: 'round' | 'square') => void;
|
|
10
|
+
export declare const setPathStrokeLinecap: (g: SVGGElement, value: 'round' | 'square') => void;
|
|
9
11
|
export declare function createMask(): SVGMaskElement;
|
|
10
12
|
export declare function createSVG(): SVGSVGElement;
|
|
11
13
|
export declare function createText(x: number, y: number, fill: string, textContent: string): SVGTextElement;
|
package/utils/dom/foreign.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare function createForeignObject(x: number, y: number, width: number, height: number): SVGForeignObjectElement;
|
|
2
|
-
export declare function updateForeignObject(
|
|
2
|
+
export declare function updateForeignObject(target: SVGForeignObjectElement | SVGGElement, width: number, height: number, x: number, y: number): void;
|
|
3
|
+
export declare function updateForeignObjectWidth(target: SVGForeignObjectElement | SVGGElement, width: number): void;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Options } from 'roughjs/bin/core';
|
|
2
2
|
import { RoughSVG } from 'roughjs/bin/svg';
|
|
3
|
+
import { PlaitBoard } from '../../interfaces/board';
|
|
4
|
+
import { RectangleClient } from '../../interfaces/rectangle-client';
|
|
3
5
|
/**
|
|
4
6
|
* drawRoundRectangle
|
|
5
7
|
*/
|
|
6
8
|
export declare function drawRoundRectangle(rs: RoughSVG, x1: number, y1: number, x2: number, y2: number, options: Options, outline?: boolean, borderRadius?: number): SVGGElement;
|
|
9
|
+
export declare const drawRectangle: (board: PlaitBoard, rectangle: RectangleClient, options: Options) => SVGGElement;
|
package/utils/math.d.ts
CHANGED
|
@@ -9,3 +9,6 @@ export declare function distanceBetweenPointAndPoint(x1: number, y1: number, x2:
|
|
|
9
9
|
export declare function distanceBetweenPointAndRectangle(x: number, y: number, rect: RectangleClient): number;
|
|
10
10
|
export declare const isLineHitLine: (a: Point, b: Point, c: Point, d: Point) => boolean;
|
|
11
11
|
export declare const isPolylineHitRectangle: (points: Point[], rectangle: RectangleClient) => boolean;
|
|
12
|
+
export declare const isPointInPolygon: (point: Point, points: Point[]) => boolean;
|
|
13
|
+
export declare const isPointInEllipse: (point: Point, center: Point, rx: number, ry: number, rotation?: number) => boolean;
|
|
14
|
+
export declare const isPointInRoundRectangle: (point: Point, rectangle: RectangleClient, radius: number) => boolean;
|