@plait/core 0.74.0 → 0.75.0-next.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.
@@ -47,7 +47,7 @@ export interface PlaitBoard {
47
47
  dblClick: (event: MouseEvent) => void;
48
48
  drawElement: (context: PlaitPluginElementContext) => ComponentType<ElementFlavour>;
49
49
  isRectangleHit: (element: PlaitElement, range: Selection) => boolean;
50
- isHit: (element: PlaitElement, point: Point) => boolean;
50
+ isHit: (element: PlaitElement, point: Point, isStrict?: boolean) => boolean;
51
51
  isInsidePoint: (element: PlaitElement, point: Point) => boolean;
52
52
  getOneHitElement: (hitElements: PlaitElement[]) => PlaitElement;
53
53
  isRecursion: (element: PlaitElement) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plait/core",
3
- "version": "0.74.0",
3
+ "version": "0.75.0-next.0",
4
4
  "peerDependencies": {
5
5
  "immer": "^10.0.3",
6
6
  "is-hotkey": "^0.2.0",
@@ -4,7 +4,7 @@ import { Point } from '../interfaces/point';
4
4
  import { FitViewportOptions } from '../interfaces/viewport';
5
5
  import { PlaitPointerType } from '../interfaces/pointer';
6
6
  declare function updateViewport(board: PlaitBoard, origination: Point, zoom?: number): void;
7
- declare function updateZoom(board: PlaitBoard, newZoom: number, isCenter?: boolean): void;
7
+ declare function updateZoom(board: PlaitBoard, newZoom: number, center?: Point): void;
8
8
  declare function fitViewport(board: PlaitBoard): void;
9
9
  declare function fitViewportWidth(board: PlaitBoard, options: FitViewportOptions): void;
10
10
  /**
package/utils/math.d.ts CHANGED
@@ -9,7 +9,9 @@ export declare function rotate(x1: number, y1: number, x2: number, y2: number, a
9
9
  export declare function distanceBetweenPointAndPoint(x1: number, y1: number, x2: number, y2: number): number;
10
10
  export declare function distanceBetweenPointAndRectangle(x: number, y: number, rect: RectangleClient): number;
11
11
  export declare const isLineHitLine: (a: Point, b: Point, c: Point, d: Point) => boolean;
12
- export declare const isPolylineHitRectangle: (points: Point[], rectangle: RectangleClient, isClose?: boolean) => boolean;
12
+ export declare const isLineHitRectangle: (points: Point[], rectangle: RectangleClient, isClose?: boolean) => boolean;
13
+ export declare const isLineHitRectangleEdge: (points: Point[], rectangle: RectangleClient, isClose?: boolean) => boolean;
14
+ export declare const isSingleLineHitRectangleEdge: (p1: Point, p2: Point, rectangle: RectangleClient) => boolean;
13
15
  export declare const isPointInPolygon: (point: Point, points: Point[]) => boolean;
14
16
  export declare const isPointInEllipse: (point: Point, center: Point, rx: number, ry: number, angle?: number) => boolean;
15
17
  export declare const isPointInRoundRectangle: (point: Point, rectangle: RectangleClient, radius: number, angle?: number) => boolean;
@@ -38,3 +40,12 @@ export declare function ceilToDecimal(value: number, decimalPlaces: number): num
38
40
  */
39
41
  export declare function approximately(a: number, b: number, precision?: number): boolean;
40
42
  export declare function getCrossingPointsBetweenEllipseAndSegment(startPoint: Point, endPoint: Point, cx: number, cy: number, rx: number, ry: number, segment_only?: boolean): number[][];
43
+ /**
44
+ * Get a point between two points.
45
+ * @param x0 The x-axis coordinate of the first point.
46
+ * @param y0 The y-axis coordinate of the first point.
47
+ * @param x1 The x-axis coordinate of the second point.
48
+ * @param y1 The y-axis coordinate of the second point.
49
+ * @param d Normalized
50
+ */
51
+ export declare function getPointBetween(x0: number, y0: number, x1: number, y1: number, d?: number): number[];
@@ -4,8 +4,8 @@ import { PlaitElement } from '../interfaces/element';
4
4
  import { Point } from '../interfaces/point';
5
5
  import { PlaitOptionsBoard } from '../plugins/with-options';
6
6
  export declare const getHitElementsBySelection: (board: PlaitBoard, selection?: Selection, match?: (element: PlaitElement) => boolean) => PlaitElement[];
7
- export declare const getHitElementsByPoint: (board: PlaitBoard, point: Point, match?: (element: PlaitElement) => boolean) => PlaitElement[];
8
- export declare const getHitElementByPoint: (board: PlaitBoard, point: Point, match?: (element: PlaitElement) => boolean) => undefined | PlaitElement;
7
+ export declare const getHitElementsByPoint: (board: PlaitBoard, point: Point, match?: (element: PlaitElement) => boolean, isStrict?: boolean) => PlaitElement[];
8
+ export declare const getHitElementByPoint: (board: PlaitBoard, point: Point, match?: (element: PlaitElement) => boolean, isStrict?: boolean) => undefined | PlaitElement;
9
9
  export declare const getHitSelectedElements: (board: PlaitBoard, point: Point) => PlaitElement[];
10
10
  export declare const cacheSelectedElements: (board: PlaitBoard, selectedElements: PlaitElement[]) => void;
11
11
  export declare const getSelectedElements: (board: PlaitBoard) => PlaitElement[];