@plait/core 0.38.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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plait/core",
3
- "version": "0.38.0",
3
+ "version": "0.40.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^16.0.0",
6
6
  "@angular/core": "^16.0.0",
@@ -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[];
@@ -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
- export declare function toPoint(x: number, y: number, container: SVGElement): Point;
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;
@@ -1,5 +1,6 @@
1
1
  import { PlaitBoard, PlaitElement } from '../interfaces';
2
2
  export declare const getMovingElements: (board: PlaitBoard) => PlaitElement[];
3
+ export declare const isMovingElements: (board: PlaitBoard) => boolean;
3
4
  export declare const addMovingElements: (board: PlaitBoard, elements: PlaitElement[]) => void;
4
5
  export declare const removeMovingElements: (board: PlaitBoard) => void;
5
6
  export declare const cacheMovingElements: (board: PlaitBoard, elements: PlaitElement[]) => void;
@@ -7,7 +7,7 @@ export declare const getHitElementsBySelection: (board: PlaitBoard, selection?:
7
7
  export declare const getHitElementByPoint: (board: PlaitBoard, point: Point, match?: (element: PlaitElement) => boolean) => undefined | PlaitElement;
8
8
  export declare const cacheSelectedElements: (board: PlaitBoard, selectedElements: PlaitElement[]) => void;
9
9
  export declare const getSelectedElements: (board: PlaitBoard) => PlaitElement[];
10
- export declare const addSelectedElement: (board: PlaitBoard, element: PlaitElement) => void;
10
+ export declare const addSelectedElement: (board: PlaitBoard, element: PlaitElement | PlaitElement[]) => void;
11
11
  export declare const removeSelectedElement: (board: PlaitBoard, element: PlaitElement) => void;
12
12
  export declare const clearSelectedElement: (board: PlaitBoard) => void;
13
13
  export declare const isSelectedElement: (board: PlaitBoard, element: PlaitElement) => boolean;
@@ -1,4 +1,5 @@
1
1
  import { PlaitBoard, Point, RectangleClient } from '../interfaces';
2
+ export declare function toSVGScreenPoint(board: PlaitBoard, point: Point): Point;
2
3
  export declare function getViewportContainerRect(board: PlaitBoard): {
3
4
  width: number;
4
5
  height: number;
@@ -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>;