@plait/core 0.51.1 → 0.51.3

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.
@@ -49,6 +49,7 @@ export interface PlaitBoard {
49
49
  destroyElement: (context: PlaitPluginElementContext) => void;
50
50
  isRectangleHit: (element: PlaitElement, range: Selection) => boolean;
51
51
  isHit: (element: PlaitElement, point: Point) => boolean;
52
+ isInsidePoint: (element: PlaitElement, point: Point) => boolean;
52
53
  isRecursion: (element: PlaitElement) => boolean;
53
54
  isMovable: (element: PlaitElement) => boolean;
54
55
  getRectangle: (element: PlaitElement) => RectangleClient | null;
@@ -7,6 +7,7 @@ export interface PlaitElement {
7
7
  children?: PlaitElement[];
8
8
  points?: Point[];
9
9
  type?: string;
10
+ groupId?: string;
10
11
  }
11
12
  export declare const PlaitElement: {
12
13
  isRootElement(value: PlaitElement): boolean;
@@ -0,0 +1,7 @@
1
+ import { PlaitElement } from "./element";
2
+ export interface PlaitGroup extends PlaitElement {
3
+ type: 'group';
4
+ }
5
+ export declare const PlaitGroupElement: {
6
+ isGroup: (value: any) => value is PlaitGroup;
7
+ };
@@ -15,3 +15,4 @@ export * from './history';
15
15
  export * from './plugin-key';
16
16
  export * from './theme';
17
17
  export * from './direction';
18
+ export * from './group';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plait/core",
3
- "version": "0.51.1",
3
+ "version": "0.51.3",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^16.0.0",
6
6
  "@angular/core": "^16.0.0",
@@ -0,0 +1,2 @@
1
+ import { PlaitBoard } from '../interfaces';
2
+ export declare function withGroup(board: PlaitBoard): PlaitBoard;
@@ -1,20 +1,7 @@
1
1
  import { PlaitBoard } from '../interfaces/board';
2
- import { PlaitElement } from '../interfaces';
3
2
  import { PlaitPluginOptions } from './with-options';
4
3
  export interface WithPluginOptions extends PlaitPluginOptions {
5
4
  isMultiple: boolean;
6
5
  isDisabledSelect: boolean;
7
6
  }
8
7
  export declare function withSelection(board: PlaitBoard): PlaitBoard;
9
- export declare function isHandleSelection(board: PlaitBoard): boolean;
10
- export declare function isSetSelectionOperation(board: PlaitBoard): boolean;
11
- export declare function getTemporaryElements(board: PlaitBoard): PlaitElement[] | undefined;
12
- export declare function getTemporaryRef(board: PlaitBoard): {
13
- elements: PlaitElement[];
14
- timeoutId: any;
15
- } | undefined;
16
- export declare function deleteTemporaryElements(board: PlaitBoard): void;
17
- export declare function isSelectionMoving(board: PlaitBoard): boolean;
18
- export declare function setSelectionMoving(board: PlaitBoard): void;
19
- export declare function clearSelectionMoving(board: PlaitBoard): void;
20
- export declare function createSelectionRectangleG(board: PlaitBoard): SVGGElement | null;
@@ -1,11 +1,11 @@
1
1
  import { Options } from 'roughjs/bin/core';
2
- import { RectangleClient } from '../../interfaces';
2
+ import { Point, RectangleClient } from '../../interfaces';
3
3
  export declare const NS = "http://www.w3.org/2000/svg";
4
4
  export declare function createG(): SVGGElement;
5
5
  export declare function createPath(): SVGPathElement;
6
6
  export declare function createRect(rectangle: RectangleClient, options?: Options): SVGRectElement;
7
7
  export declare const setStrokeLinecap: (g: SVGGElement, value: 'round' | 'square') => void;
8
- export declare const setTransformRotate: (g: SVGGElement, rectangle: RectangleClient, angle: number) => void;
8
+ export declare const setAngleForG: (g: SVGGElement, centerPoint: Point, angle: number) => void;
9
9
  export declare const setPathStrokeLinecap: (g: SVGGElement, value: 'round' | 'square') => void;
10
10
  export declare function createMask(): SVGMaskElement;
11
11
  export declare function createSVG(): SVGSVGElement;
@@ -0,0 +1,22 @@
1
+ import { PlaitBoard, PlaitElement } from '../interfaces';
2
+ import { PlaitGroup } from '../interfaces/group';
3
+ export declare const getElementsInGroup: (board: PlaitBoard, group: PlaitGroup, recursion?: boolean, includeGroup?: boolean) => PlaitElement[];
4
+ export declare const getRectangleByGroup: (board: PlaitBoard, group: PlaitGroup, recursion?: boolean) => import("../interfaces").RectangleClient;
5
+ export declare const getGroupByElement: (board: PlaitBoard, element: PlaitElement, recursion?: boolean) => PlaitGroup | PlaitGroup[] | null;
6
+ export declare const getHighestGroup: (board: PlaitBoard, element: PlaitElement) => PlaitGroup | null;
7
+ export declare const getElementsInGroupByElement: (board: PlaitBoard, element: PlaitElement) => PlaitElement[];
8
+ export declare const isSelectedElementOrGroup: (board: PlaitBoard, element: PlaitElement) => boolean;
9
+ export declare const isSelectedAllElementsInGroup: (board: PlaitBoard, group: PlaitGroup) => boolean;
10
+ export declare const getSelectedGroups: (board: PlaitBoard, groups: PlaitGroup[]) => PlaitGroup[];
11
+ export declare const getHighestSelectedGroup: (board: PlaitBoard, element: PlaitElement) => PlaitGroup | null;
12
+ export declare const getHighestSelectedGroups: (board: PlaitBoard) => PlaitGroup[];
13
+ export declare const getSelectedIsolatedElements: (board: PlaitBoard) => PlaitElement[];
14
+ export declare const getHighestSelectedElements: (board: PlaitBoard) => PlaitElement[];
15
+ export declare const createGroupRectangleG: (board: PlaitBoard, elements: PlaitElement[]) => SVGGElement | null;
16
+ export declare const createGroup: () => PlaitGroup;
17
+ export declare const nonGroupInHighestSelectedElements: (elements: PlaitElement[]) => boolean;
18
+ export declare const hasSelectedElementsInSameGroup: (elements: PlaitElement[]) => boolean;
19
+ export declare const canAddGroup: (highestSelectedElements: PlaitElement[]) => boolean;
20
+ export declare const addGroup: (board: PlaitBoard) => void;
21
+ export declare const canRemoveGroup: (board: PlaitBoard, selectedGroups: PlaitGroup[]) => boolean;
22
+ export declare const removeGroup: (board: PlaitBoard) => void;
package/utils/index.d.ts CHANGED
@@ -25,3 +25,5 @@ export * from './clipboard';
25
25
  export * from './touch';
26
26
  export * from './dnd';
27
27
  export * from './to-point';
28
+ export * from './group';
29
+ export * from './selection';
package/utils/math.d.ts CHANGED
@@ -8,10 +8,10 @@ export declare function rotate(x1: number, y1: number, x2: number, y2: number, a
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;
10
10
  export declare const isLineHitLine: (a: Point, b: Point, c: Point, d: Point) => boolean;
11
- export declare const isPolylineHitRectangle: (points: Point[], rectangle: RectangleClient) => boolean;
11
+ export declare const isPolylineHitRectangle: (points: Point[], rectangle: RectangleClient, isClose?: boolean) => boolean;
12
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;
13
+ export declare const isPointInEllipse: (point: Point, center: Point, rx: number, ry: number, angle?: number) => boolean;
14
+ export declare const isPointInRoundRectangle: (point: Point, rectangle: RectangleClient, radius: number, angle?: number) => boolean;
15
15
  export declare const catmullRomFitting: (points: Point[]) => Point[];
16
16
  /**
17
17
  * the result of slope is based on Cartesian coordinate system
@@ -0,0 +1,13 @@
1
+ import { PlaitBoard } from '../interfaces';
2
+ export declare function isSelectionMoving(board: PlaitBoard): boolean;
3
+ export declare function setSelectionMoving(board: PlaitBoard): void;
4
+ export declare function clearSelectionMoving(board: PlaitBoard): void;
5
+ export declare function isHandleSelection(board: PlaitBoard): boolean;
6
+ export declare function isSetSelectionOperation(board: PlaitBoard): boolean;
7
+ export declare function getTemporaryElements(board: PlaitBoard): import("../interfaces").PlaitElement[] | undefined;
8
+ export declare function getTemporaryRef(board: PlaitBoard): {
9
+ elements: import("../interfaces").PlaitElement[];
10
+ timeoutId: any;
11
+ } | undefined;
12
+ export declare function deleteTemporaryElements(board: PlaitBoard): void;
13
+ export declare function createSelectionRectangleG(board: PlaitBoard): SVGGElement | null;