@plait/draw 0.53.0 → 0.55.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.
Files changed (70) hide show
  1. package/constants/geometry.d.ts +25 -1
  2. package/engines/basic-shapes/circle.d.ts +8 -0
  3. package/engines/basic-shapes/cloud.d.ts +2 -0
  4. package/engines/flowchart/off-page.d.ts +4 -0
  5. package/engines/flowchart/or.d.ts +2 -0
  6. package/engines/flowchart/predefined-process.d.ts +2 -0
  7. package/engines/flowchart/summing-junction.d.ts +2 -0
  8. package/esm2022/constants/geometry.mjs +15 -3
  9. package/esm2022/engines/basic-shapes/circle.mjs +51 -0
  10. package/esm2022/engines/basic-shapes/cloud.mjs +57 -0
  11. package/esm2022/engines/basic-shapes/ellipse.mjs +3 -41
  12. package/esm2022/engines/flowchart/off-page.mjs +32 -0
  13. package/esm2022/engines/flowchart/or.mjs +25 -0
  14. package/esm2022/engines/flowchart/predefined-process.mjs +47 -0
  15. package/esm2022/engines/flowchart/summing-junction.mjs +28 -0
  16. package/esm2022/engines/index.mjs +12 -2
  17. package/esm2022/generators/line-auto-complete.generator.mjs +1 -1
  18. package/esm2022/geometry.component.mjs +7 -8
  19. package/esm2022/image.component.mjs +6 -7
  20. package/esm2022/interfaces/element.mjs +2 -1
  21. package/esm2022/interfaces/geometry.mjs +6 -1
  22. package/esm2022/interfaces/index.mjs +2 -2
  23. package/esm2022/line.component.mjs +8 -9
  24. package/esm2022/plugins/with-draw-fragment.mjs +7 -7
  25. package/esm2022/plugins/with-draw-hotkey.mjs +1 -1
  26. package/esm2022/plugins/with-draw-resize.mjs +73 -26
  27. package/esm2022/plugins/with-draw-rotate.mjs +127 -0
  28. package/esm2022/plugins/with-draw.mjs +6 -5
  29. package/esm2022/plugins/with-geometry-create.mjs +21 -5
  30. package/esm2022/plugins/with-geometry-resize.mjs +17 -23
  31. package/esm2022/plugins/with-line-auto-complete-reaction.mjs +2 -2
  32. package/esm2022/plugins/with-line-auto-complete.mjs +15 -13
  33. package/esm2022/plugins/with-line-bound-reaction.mjs +19 -21
  34. package/esm2022/plugins/with-line-create.mjs +4 -4
  35. package/esm2022/plugins/with-line-resize.mjs +11 -12
  36. package/esm2022/transforms/line.mjs +4 -4
  37. package/esm2022/utils/geometry.mjs +35 -23
  38. package/esm2022/utils/hit.mjs +26 -26
  39. package/esm2022/utils/line/elbow.mjs +11 -6
  40. package/esm2022/utils/line/line-basic.mjs +25 -30
  41. package/esm2022/utils/line/line-common.mjs +3 -3
  42. package/esm2022/utils/line/line-resize.mjs +2 -2
  43. package/esm2022/utils/position/geometry.mjs +59 -21
  44. package/esm2022/utils/shape.mjs +2 -2
  45. package/esm2022/utils/snap-resizing.mjs +185 -0
  46. package/esm2022/utils/style/stroke.mjs +9 -2
  47. package/fesm2022/plait-draw.mjs +1393 -1121
  48. package/fesm2022/plait-draw.mjs.map +1 -1
  49. package/generators/line-auto-complete.generator.d.ts +3 -3
  50. package/geometry.component.d.ts +2 -3
  51. package/image.component.d.ts +2 -3
  52. package/interfaces/element.d.ts +2 -1
  53. package/interfaces/geometry.d.ts +7 -2
  54. package/interfaces/index.d.ts +2 -2
  55. package/line.component.d.ts +2 -3
  56. package/package.json +1 -1
  57. package/plugins/with-draw-fragment.d.ts +2 -2
  58. package/plugins/with-draw-resize.d.ts +9 -5
  59. package/plugins/with-draw-rotate.d.ts +2 -0
  60. package/utils/geometry.d.ts +7 -4
  61. package/utils/hit.d.ts +3 -1
  62. package/utils/line/elbow.d.ts +3 -0
  63. package/utils/line/line-basic.d.ts +4 -4
  64. package/utils/position/geometry.d.ts +16 -2
  65. package/utils/shape.d.ts +2 -2
  66. package/utils/snap-resizing.d.ts +25 -0
  67. package/esm2022/utils/resize-align-reaction.mjs +0 -316
  68. package/esm2022/utils/resize-align.mjs +0 -37
  69. package/utils/resize-align-reaction.d.ts +0 -42
  70. package/utils/resize-align.d.ts +0 -8
@@ -1,12 +1,12 @@
1
1
  import { PlaitBoard } from '@plait/core';
2
- import { PlaitGeometry, PlaitShape } from '../interfaces';
2
+ import { PlaitGeometry, PlaitShapeElement } from '../interfaces';
3
3
  import { ActiveGeneratorExtraData, Generator } from '@plait/common';
4
- export declare class LineAutoCompleteGenerator extends Generator<PlaitShape, ActiveGeneratorExtraData> {
4
+ export declare class LineAutoCompleteGenerator extends Generator<PlaitShapeElement, ActiveGeneratorExtraData> {
5
5
  board: PlaitBoard;
6
6
  autoCompleteG: SVGGElement;
7
7
  hoverElement: SVGGElement | null;
8
8
  constructor(board: PlaitBoard);
9
- canDraw(element: PlaitShape, data: ActiveGeneratorExtraData): boolean;
9
+ canDraw(element: PlaitShapeElement, data: ActiveGeneratorExtraData): boolean;
10
10
  draw(element: PlaitGeometry, data: ActiveGeneratorExtraData): SVGGElement;
11
11
  removeAutoCompleteG(index: number): void;
12
12
  recoverAutoCompleteG(): void;
@@ -1,4 +1,4 @@
1
- import { ChangeDetectorRef, OnDestroy, OnInit, ViewContainerRef } from '@angular/core';
1
+ import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
2
2
  import { PlaitBoard, PlaitPluginElementContext, OnContextChanged } from '@plait/core';
3
3
  import { Subject } from 'rxjs';
4
4
  import { PlaitGeometry } from './interfaces/geometry';
@@ -8,14 +8,13 @@ import { ActiveGenerator, CommonPluginElement } from '@plait/common';
8
8
  import { LineAutoCompleteGenerator } from './generators/line-auto-complete.generator';
9
9
  import * as i0 from "@angular/core";
10
10
  export declare class GeometryComponent extends CommonPluginElement<PlaitGeometry, PlaitBoard> implements OnInit, OnDestroy, OnContextChanged<PlaitGeometry, PlaitBoard> {
11
- private viewContainerRef;
12
11
  protected cdr: ChangeDetectorRef;
13
12
  destroy$: Subject<void>;
14
13
  activeGenerator: ActiveGenerator<PlaitGeometry>;
15
14
  lineAutoCompleteGenerator: LineAutoCompleteGenerator;
16
15
  shapeGenerator: GeometryShapeGenerator;
17
16
  get textManage(): TextManage;
18
- constructor(viewContainerRef: ViewContainerRef, cdr: ChangeDetectorRef);
17
+ constructor(cdr: ChangeDetectorRef);
19
18
  initializeGenerator(): void;
20
19
  ngOnInit(): void;
21
20
  onContextChanged(value: PlaitPluginElementContext<PlaitGeometry, PlaitBoard>, previous: PlaitPluginElementContext<PlaitGeometry, PlaitBoard>): void;
@@ -1,4 +1,4 @@
1
- import { ChangeDetectorRef, OnDestroy, OnInit, ViewContainerRef } from '@angular/core';
1
+ import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
2
2
  import { PlaitBoard, PlaitPluginElementContext, OnContextChanged } from '@plait/core';
3
3
  import { Subject } from 'rxjs';
4
4
  import { CommonPluginElement, ImageGenerator } from '@plait/common';
@@ -6,13 +6,12 @@ import { PlaitImage } from './interfaces/image';
6
6
  import { LineAutoCompleteGenerator } from './generators/line-auto-complete.generator';
7
7
  import * as i0 from "@angular/core";
8
8
  export declare class ImageComponent extends CommonPluginElement<PlaitImage, PlaitBoard> implements OnInit, OnDestroy, OnContextChanged<PlaitImage, PlaitBoard> {
9
- private viewContainerRef;
10
9
  protected cdr: ChangeDetectorRef;
11
10
  destroy$: Subject<void>;
12
11
  get activeGenerator(): import("@plait/common").ActiveGenerator<import("@plait/core").PlaitElement>;
13
12
  imageGenerator: ImageGenerator<PlaitImage>;
14
13
  lineAutoCompleteGenerator: LineAutoCompleteGenerator;
15
- constructor(viewContainerRef: ViewContainerRef, cdr: ChangeDetectorRef);
14
+ constructor(cdr: ChangeDetectorRef);
16
15
  initializeGenerator(): void;
17
16
  ngOnInit(): void;
18
17
  onContextChanged(value: PlaitPluginElementContext<PlaitImage, PlaitBoard>, previous: PlaitPluginElementContext<PlaitImage, PlaitBoard>): void;
@@ -1,6 +1,7 @@
1
1
  export declare enum StrokeStyle {
2
2
  solid = "solid",
3
- dashed = "dashed"
3
+ dashed = "dashed",
4
+ dotted = "dotted"
4
5
  }
5
6
  export declare enum MemorizeKey {
6
7
  basicShape = "basicShape",
@@ -22,7 +22,8 @@ export declare enum BasicShapes {
22
22
  processArrow = "processArrow",
23
23
  twoWayArrow = "twoWayArrow",
24
24
  comment = "comment",
25
- roundComment = "roundComment"
25
+ roundComment = "roundComment",
26
+ cloud = "cloud"
26
27
  }
27
28
  export declare enum FlowchartSymbols {
28
29
  process = "process",
@@ -35,7 +36,11 @@ export declare enum FlowchartSymbols {
35
36
  manualLoop = "manualLoop",
36
37
  merge = "merge",
37
38
  delay = "delay",
38
- storedData = "storedData"
39
+ storedData = "storedData",
40
+ or = "or",
41
+ summingJunction = "summingJunction",
42
+ predefinedProcess = "predefinedProcess",
43
+ offPage = "offPage"
39
44
  }
40
45
  export type GeometryShapes = BasicShapes | FlowchartSymbols;
41
46
  export interface PlaitGeometry extends PlaitElement {
@@ -7,14 +7,14 @@ export * from './geometry';
7
7
  export * from './text';
8
8
  export * from './element';
9
9
  export type PlaitDrawElement = PlaitGeometry | PlaitLine | PlaitImage;
10
- export type PlaitShape = PlaitGeometry | PlaitImage;
10
+ export type PlaitShapeElement = PlaitGeometry | PlaitImage;
11
11
  export declare const PlaitDrawElement: {
12
12
  isGeometry: (value: any) => value is PlaitGeometry;
13
13
  isLine: (value: any) => value is PlaitLine;
14
14
  isText: (value: any) => value is PlaitText;
15
15
  isImage: (value: any) => value is PlaitImage;
16
16
  isDrawElement: (value: any) => value is PlaitDrawElement;
17
- isShape: (value: any) => value is PlaitShape;
17
+ isShapeElement: (value: any) => value is PlaitShapeElement;
18
18
  isBasicShape: (value: any) => boolean;
19
19
  isFlowchart: (value: any) => boolean;
20
20
  };
@@ -1,4 +1,4 @@
1
- import { ChangeDetectorRef, OnDestroy, OnInit, ViewContainerRef } from '@angular/core';
1
+ import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
2
2
  import { PlaitBoard, PlaitPluginElementContext, OnContextChanged } from '@plait/core';
3
3
  import { Subject } from 'rxjs';
4
4
  import { LineText, PlaitGeometry, PlaitLine } from './interfaces';
@@ -12,13 +12,12 @@ interface BoundedElements {
12
12
  target?: PlaitGeometry;
13
13
  }
14
14
  export declare class LineComponent extends CommonPluginElement<PlaitLine, PlaitBoard> implements OnInit, OnDestroy, OnContextChanged<PlaitLine, PlaitBoard> {
15
- private viewContainerRef;
16
15
  protected cdr: ChangeDetectorRef;
17
16
  destroy$: Subject<void>;
18
17
  shapeGenerator: LineShapeGenerator;
19
18
  activeGenerator: LineActiveGenerator;
20
19
  boundedElements: BoundedElements;
21
- constructor(viewContainerRef: ViewContainerRef, cdr: ChangeDetectorRef);
20
+ constructor(cdr: ChangeDetectorRef);
22
21
  initializeGenerator(): void;
23
22
  ngOnInit(): void;
24
23
  getBoundedElements(): BoundedElements;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plait/draw",
3
- "version": "0.53.0",
3
+ "version": "0.55.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^17.2.4",
6
6
  "@angular/core": "^17.2.4",
@@ -1,4 +1,4 @@
1
1
  import { PlaitBoard } from '@plait/core';
2
- import { PlaitLine, PlaitShape } from '../interfaces';
2
+ import { PlaitLine, PlaitShapeElement } from '../interfaces';
3
3
  export declare const withDrawFragment: (baseBoard: PlaitBoard) => PlaitBoard;
4
- export declare const getBoundedLineElements: (board: PlaitBoard, plaitShapes: PlaitShape[]) => PlaitLine[];
4
+ export declare const getBoundedLineElements: (board: PlaitBoard, plaitShapes: PlaitShapeElement[]) => PlaitLine[];
@@ -1,6 +1,4 @@
1
- import { ResizeRef, ResizeState } from '@plait/common';
2
- import { PlaitBoard, Point } from '@plait/core';
3
- import { PlaitDrawElement } from '../interfaces';
1
+ import { PlaitBoard, Point, RectangleClient } from '@plait/core';
4
2
  export interface BulkRotationRef {
5
3
  angle: number;
6
4
  offsetX: number;
@@ -8,12 +6,18 @@ export interface BulkRotationRef {
8
6
  newCenterPoint: Point;
9
7
  }
10
8
  export declare function withDrawResize(board: PlaitBoard): PlaitBoard;
11
- export declare const getResizeOriginPointAndHandlePoint: (board: PlaitBoard, resizeRef: ResizeRef<PlaitDrawElement | PlaitDrawElement[]>) => {
9
+ export declare const getResizeOriginPointAndHandlePoint: (board: PlaitBoard, handleIndex: number, rectangle: RectangleClient) => {
12
10
  originPoint: Point;
13
11
  handlePoint: Point;
14
12
  };
15
- export declare const getResizeZoom: (resizeState: ResizeState, resizeOriginPoint: Point, resizeHandlePoint: Point, isFromCorner: boolean, isAspectRatio: boolean) => {
13
+ export declare const getResizeZoom: (resizeStartAndEnd: [Point, Point], resizeOriginPoint: Point, resizeHandlePoint: Point, isFromCorner: boolean, isAspectRatio: boolean) => {
16
14
  xZoom: number;
17
15
  yZoom: number;
18
16
  };
19
17
  export declare const movePointByZoomAndOriginPoint: (p: Point, resizeOriginPoint: Point, xZoom: number, yZoom: number) => Point;
18
+ /**
19
+ * 1. Rotate 90°
20
+ * 2. Scale based on the rotated points
21
+ * 3. Reverse rotate the scaled points by 90°
22
+ */
23
+ export declare const getResizePointsByOtherwiseAxis: (board: PlaitBoard, points: Point[], resizeOriginPoint: Point, xZoom: number, yZoom: number) => Point[];
@@ -0,0 +1,2 @@
1
+ import { PlaitBoard } from '@plait/core';
2
+ export declare const withDrawRotate: (board: PlaitBoard) => PlaitBoard;
@@ -4,7 +4,7 @@ import { Alignment, CustomText } from '@plait/text';
4
4
  import { Element } from 'slate';
5
5
  import { DrawPointerType } from '../constants';
6
6
  import { Options } from 'roughjs/bin/core';
7
- import { PlaitShape } from '../interfaces';
7
+ import { PlaitShapeElement } from '../interfaces';
8
8
  export type GeometryStyleOptions = Pick<PlaitGeometry, 'fill' | 'strokeColor' | 'strokeWidth'>;
9
9
  export type TextProperties = Partial<CustomText> & {
10
10
  align?: Alignment;
@@ -17,9 +17,12 @@ export declare const getTextRectangle: (element: PlaitGeometry) => {
17
17
  x: number;
18
18
  y: number;
19
19
  };
20
- export declare const drawBoundMask: (board: PlaitBoard, element: PlaitGeometry) => SVGGElement;
20
+ export declare const drawBoundReaction: (board: PlaitBoard, element: PlaitGeometry, options?: {
21
+ hasMask: boolean;
22
+ hasConnector: boolean;
23
+ }) => SVGGElement;
21
24
  export declare const drawGeometry: (board: PlaitBoard, outerRectangle: RectangleClient, shape: GeometryShapes, options: Options) => SVGGElement;
22
- export declare const getNearestPoint: (element: PlaitShape, point: Point) => Point;
25
+ export declare const getNearestPoint: (element: PlaitShapeElement, point: Point) => Point;
23
26
  export declare const getCenterPointsOnPolygon: (points: Point[]) => Point[];
24
27
  export declare const getDefaultFlowchartProperty: (symbol: FlowchartSymbols) => {
25
28
  width: number;
@@ -41,7 +44,7 @@ export declare const getDefaultFlowchartProperty: (symbol: FlowchartSymbols) =>
41
44
  height: number;
42
45
  };
43
46
  export declare const createDefaultFlowchart: (point: Point) => (PlaitGeometry | import("../interfaces").PlaitLine)[];
44
- export declare const getAutoCompletePoints: (element: PlaitShape) => [Point, Point, Point, Point];
47
+ export declare const getAutoCompletePoints: (element: PlaitShapeElement) => [Point, Point, Point, Point];
45
48
  export declare const getHitIndexOfAutoCompletePoint: (movingPoint: Point, points: Point[]) => number;
46
49
  export declare const getDrawDefaultStrokeColor: (theme: ThemeColorMode) => string;
47
50
  export declare const getFlowchartDefaultFill: (theme: ThemeColorMode) => string;
package/utils/hit.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import { PlaitElement, Selection, PlaitBoard, Point } from '@plait/core';
2
- import { PlaitGeometry, PlaitLine } from '../interfaces';
2
+ import { PlaitGeometry, PlaitLine, PlaitShapeElement } from '../interfaces';
3
3
  export declare const isTextExceedingBounds: (geometry: PlaitGeometry) => boolean;
4
4
  export declare const isHitLineText: (board: PlaitBoard, element: PlaitLine, point: Point) => boolean;
5
5
  export declare const isHitPolyLine: (pathPoints: Point[], point: Point) => boolean;
6
6
  export declare const isHitLine: (board: PlaitBoard, element: PlaitLine, point: Point) => boolean;
7
7
  export declare const isRectangleHitDrawElement: (board: PlaitBoard, element: PlaitElement, selection: Selection) => boolean | null;
8
8
  export declare const isHitDrawElement: (board: PlaitBoard, element: PlaitElement, point: Point) => boolean | null;
9
+ export declare const isHitEdgeOfShape: (board: PlaitBoard, element: PlaitShapeElement, point: Point, hitDistanceBuffer: number) => boolean;
10
+ export declare const isInsideOfShape: (board: PlaitBoard, element: PlaitShapeElement, point: Point, hitDistanceBuffer: number) => boolean;
9
11
  export declare const isHitElementInside: (board: PlaitBoard, element: PlaitElement, point: Point) => boolean | null;
@@ -1,5 +1,8 @@
1
1
  import { Point, PlaitBoard, RectangleClient } from '@plait/core';
2
+ import { ElbowLineRouteOptions } from '@plait/common';
2
3
  import { LineHandleRefPair, PlaitLine } from '../../interfaces';
4
+ export declare const isSelfLoop: (element: PlaitLine) => boolean | "" | undefined;
5
+ export declare const isUseDefaultOrthogonalRoute: (element: PlaitLine, options: ElbowLineRouteOptions) => boolean;
3
6
  export declare const getElbowPoints: (board: PlaitBoard, element: PlaitLine) => Point[];
4
7
  export declare const getNextSourceAndTargetPoints: (board: PlaitBoard, element: PlaitLine) => Point[];
5
8
  export declare const getSourceAndTargetRectangle: (board: PlaitBoard, element: PlaitLine, handleRefPair: LineHandleRefPair) => {
@@ -1,13 +1,13 @@
1
1
  import { Point, PlaitBoard, RectangleClient } from '@plait/core';
2
- import { LineHandle, LineShape, LineText, PlaitLine, PlaitShape } from '../../interfaces';
2
+ import { LineHandle, LineShape, LineText, PlaitLine, PlaitShapeElement } from '../../interfaces';
3
3
  export declare const createLineElement: (shape: LineShape, points: [Point, Point], source: LineHandle, target: LineHandle, texts?: LineText[], options?: Pick<PlaitLine, 'strokeColor' | 'strokeWidth'>) => PlaitLine;
4
4
  export declare const getLinePoints: (board: PlaitBoard, element: PlaitLine) => Point[];
5
5
  export declare const getCurvePoints: (board: PlaitBoard, element: PlaitLine) => Point[];
6
6
  export declare function getMiddlePoints(board: PlaitBoard, element: PlaitLine): Point[];
7
7
  export declare const drawLine: (board: PlaitBoard, element: PlaitLine) => SVGGElement;
8
- export declare const getConnectionByNearestPoint: (board: PlaitBoard, point: Point, hitElement: PlaitShape) => Point;
9
- export declare const getHitConnectorPoint: (point: Point, hitElement: PlaitShape, rectangle: RectangleClient) => Point | undefined;
8
+ export declare const getHitConnection: (board: PlaitBoard, point: Point, hitElement: PlaitShapeElement) => Point;
9
+ export declare const getHitConnectorPoint: (point: Point, hitElement: PlaitShapeElement) => Point | undefined;
10
10
  export declare const getLineTextRectangle: (board: PlaitBoard, element: PlaitLine, index: number) => RectangleClient;
11
11
  export declare const getLines: (board: PlaitBoard) => PlaitLine[];
12
12
  export declare const Q2C: (points: Point[]) => Point[];
13
- export declare const handleLineCreating: (board: PlaitBoard, lineShape: LineShape, sourcePoint: Point, movingPoint: Point, sourceElement: PlaitShape | null, lineShapeG: SVGGElement) => PlaitLine;
13
+ export declare const handleLineCreating: (board: PlaitBoard, lineShape: LineShape, sourcePoint: Point, movingPoint: Point, sourceElement: PlaitShapeElement | null, lineShapeG: SVGGElement) => PlaitLine;
@@ -1,5 +1,5 @@
1
1
  import { PlaitBoard, Point, RectangleClient } from '@plait/core';
2
- import { PlaitGeometry } from '../../interfaces';
2
+ import { PlaitGeometry, PlaitShapeElement } from '../../interfaces';
3
3
  export declare const getHitRectangleResizeHandleRef: (board: PlaitBoard, rectangle: RectangleClient, point: Point, angle?: number) => {
4
4
  rectangle: {
5
5
  x: number;
@@ -10,4 +10,18 @@ export declare const getHitRectangleResizeHandleRef: (board: PlaitBoard, rectang
10
10
  handle: import("@plait/common").ResizeHandle;
11
11
  cursorClass: import("@plait/core").ResizeCursorClass;
12
12
  } | undefined;
13
- export declare const getHitOutlineGeometry: (board: PlaitBoard, point: Point, offset?: number) => PlaitGeometry | null;
13
+ export declare const getSnappingGeometry: (board: PlaitBoard, point: Point) => PlaitGeometry | null;
14
+ export declare const getSnappingRef: (board: PlaitBoard, hitElement: PlaitShapeElement, point: Point) => {
15
+ isHitEdge: boolean;
16
+ isHitConnector: boolean;
17
+ connectorPoint: Point | undefined;
18
+ edgePoint: Point;
19
+ };
20
+ export declare const getHitGeometry: (board: PlaitBoard, point: Point, offset?: number) => PlaitGeometry | null;
21
+ export declare const traverseDrawShapes: (board: PlaitBoard, callback: (element: PlaitShapeElement) => void) => void;
22
+ export declare const getRotateHandleRectangle: (rectangle: RectangleClient) => {
23
+ x: number;
24
+ y: number;
25
+ width: number;
26
+ height: number;
27
+ };
package/utils/shape.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { PlaitShape } from '../interfaces';
2
- export declare const getShape: (value: PlaitShape) => import("../interfaces").GeometryShapes;
1
+ import { PlaitShapeElement } from '../interfaces';
2
+ export declare const getElementShape: (value: PlaitShapeElement) => import("../interfaces").GeometryShapes;
@@ -0,0 +1,25 @@
1
+ import { ResizeRef, ResizeState } from '@plait/common';
2
+ import { DirectionFactors, PlaitBoard, PlaitElement, Point, RectangleClient, SnapRef } from '@plait/core';
3
+ import { PlaitDrawElement } from '../interfaces';
4
+ export declare const debugGenerator: import("@plait/core").DebugGenerator;
5
+ export interface ResizeSnapRef extends SnapRef {
6
+ xZoom: number;
7
+ yZoom: number;
8
+ activePoints: Point[];
9
+ }
10
+ export interface ResizeSnapOptions {
11
+ resizePoints: Point[];
12
+ activeRectangle: RectangleClient;
13
+ directionFactors: DirectionFactors;
14
+ isFromCorner: boolean;
15
+ isAspectRatio: boolean;
16
+ resizeOriginPoint?: Point[];
17
+ originPoint?: Point;
18
+ handlePoint?: Point;
19
+ isCreate?: boolean;
20
+ }
21
+ export declare function getSnapResizingRefOptions(board: PlaitBoard, resizeRef: ResizeRef<PlaitDrawElement | PlaitDrawElement[]>, resizeState: ResizeState, resizeOriginPointAndHandlePoint: {
22
+ originPoint: Point;
23
+ handlePoint: Point;
24
+ }, isAspectRatio: boolean, isFromCorner: boolean): ResizeSnapOptions;
25
+ export declare function getSnapResizingRef(board: PlaitBoard, activeElements: PlaitElement[], resizeSnapOptions: ResizeSnapOptions): ResizeSnapRef;