@plait/draw 0.51.1 → 0.51.2

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.
@@ -17,7 +17,7 @@ export const getHitOutlineGeometry = (board, point, offset = 0) => {
17
17
  let client = RectangleClient.getRectangleByPoints(node.points);
18
18
  client = RectangleClient.getOutlineRectangle(client, offset);
19
19
  const shape = getShape(node);
20
- const isHit = getEngine(shape).isHit(client, point);
20
+ const isHit = getEngine(shape).isInsidePoint(client, point);
21
21
  if (isHit) {
22
22
  geometry = node;
23
23
  }
@@ -25,4 +25,4 @@ export const getHitOutlineGeometry = (board, point, offset = 0) => {
25
25
  }, getIsRecursionFunc(board), true);
26
26
  return geometry;
27
27
  };
28
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VvbWV0cnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9kcmF3L3NyYy91dGlscy9wb3NpdGlvbi9nZW9tZXRyeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQStCLGVBQWUsRUFBRSxtQkFBbUIsRUFBRSxrQkFBa0IsRUFBRSxNQUFNLGFBQWEsQ0FBQztBQUNwSCxPQUFPLEVBQUUsZ0JBQWdCLEVBQWlCLE1BQU0sa0JBQWtCLENBQUM7QUFDbkUsT0FBTyxFQUFFLHNCQUFzQixFQUFFLDRCQUE0QixFQUFnQixNQUFNLGVBQWUsQ0FBQztBQUNuRyxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRTFDLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxVQUFVLENBQUM7QUFFcEMsTUFBTSxDQUFDLE1BQU0sOEJBQThCLEdBQUcsQ0FBQyxLQUFpQixFQUFFLFNBQTBCLEVBQUUsS0FBWSxFQUFFLEVBQUU7SUFDM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AgICAgICBnZW9tZXRyeSA9IG5vZGU7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBnZXRJc1JlY3Vyc2lvbkZ1bmMoYm9hcmQpLFxuICAgICAgICB0cnVlXG4gICAgKTtcbiAgICByZXR1cm4gZ2VvbWV0cnk7XG59O1xuIl19
@@ -1,4 +1,4 @@
1
- import { ACTIVE_STROKE_WIDTH, ThemeColorMode, Point, RectangleClient, getElementById, createG, arrowPoints, createPath, distanceBetweenPointAndPoint, drawLinearPath, rotate, depthFirstRecursion, getIsRecursionFunc, idCreator, catmullRomFitting, PlaitBoard, findElements, createMask, createRect, getSelectedElements, distanceBetweenPointAndSegments, isPolylineHitRectangle, setStrokeLinecap, isPointInPolygon, getNearestPointBetweenPointAndSegments, isPointInEllipse, getEllipseTangentSlope, getVectorFromPointAndSlope, drawRectangle, drawRoundRectangle, isPointInRoundRectangle, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, drawCircle, Transforms, clearSelectedElement, addSelectedElement, BoardTransforms, PlaitPointerType, Direction, Path, PlaitNode, toViewBoxPoint, toHostPoint, isSelectionMoving, RgbaToHEX, PlaitElement, preventTouchMove, createClipboardContext, WritableClipboardType, addClipboardContext, getRectangleByElements, getHitElementByPoint, CursorClass, temporaryDisableSelection, PRESS_AND_MOVE_BUFFER } from '@plait/core';
1
+ import { ACTIVE_STROKE_WIDTH, ThemeColorMode, Point, RectangleClient, getElementById, createG, arrowPoints, createPath, distanceBetweenPointAndPoint, drawLinearPath, rotate, depthFirstRecursion, getIsRecursionFunc, idCreator, catmullRomFitting, PlaitBoard, findElements, createMask, createRect, getSelectedElements, distanceBetweenPointAndSegments, HIT_DISTANCE_BUFFER, isPolylineHitRectangle, setStrokeLinecap, isPointInPolygon, getNearestPointBetweenPointAndSegments, isPointInEllipse, getEllipseTangentSlope, getVectorFromPointAndSlope, drawRectangle, drawRoundRectangle, isPointInRoundRectangle, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, drawCircle, Transforms, clearSelectedElement, addSelectedElement, BoardTransforms, PlaitPointerType, Direction, Path, PlaitNode, toViewBoxPoint, toHostPoint, isSelectionMoving, RgbaToHEX, PlaitElement, preventTouchMove, createClipboardContext, WritableClipboardType, addClipboardContext, getRectangleByElements, getHitElementByPoint, CursorClass, temporaryDisableSelection, PRESS_AND_MOVE_BUFFER } from '@plait/core';
2
2
  import { removeDuplicatePoints, generateElbowLineRoute, simplifyOrthogonalPoints, isSourceAndTargetIntersect, getPoints, getPointByVector, getExtendPoint, getUnitVectorByPointAndPoint, Generator, getRectangleResizeHandleRefs, RESIZE_HANDLE_DIAMETER, getMemorizedLatest, memorizeLatest, getPointOnPolyline, TRANSPARENT, getCrossingPointsBetweenPointAndSegment, isPointOnSegment, getDirectionByVector, getOppositeDirection, getDirectionFactor, getDirectionByPointOfRectangle, rotateVectorAnti90, getSourceAndTargetOuterRectangle, getNextPoint, normalizeShapePoints, getFirstTextEditor, PRIMARY_COLOR, CommonPluginElement, ActiveGenerator, WithTextPluginKey, drawPrimaryHandle, drawFillPrimaryHandle, isVirtualKey, isDelete, isSpaceHotkey, isDndMode, isDrawingMode, getElementsText, acceptImageTypes, getElementOfFocusedImage, buildImage, getDirectionFactorByVectorComponent, isCornerHandle, getFirstTextManage, withResize, drawHandle, getIndexByResizeHandle, getSymmetricHandleIndex, getResizeHandlePointByIndex, isResizingByCondition, getRatioByPoint, ImageGenerator, ResizeHandle } from '@plait/common';
3
3
  import { Alignment, buildText, DEFAULT_FONT_SIZE, getTextSize, AlignEditor, TextManage } from '@plait/text';
4
4
  import { pointsOnBezierCurves } from 'points-on-curve';
@@ -720,7 +720,7 @@ const getHitOutlineGeometry = (board, point, offset = 0) => {
720
720
  let client = RectangleClient.getRectangleByPoints(node.points);
721
721
  client = RectangleClient.getOutlineRectangle(client, offset);
722
722
  const shape = getShape(node);
723
- const isHit = getEngine(shape).isHit(client, point);
723
+ const isHit = getEngine(shape).isInsidePoint(client, point);
724
724
  if (isHit) {
725
725
  geometry = node;
726
726
  }
@@ -1133,9 +1133,14 @@ const isTextExceedingBounds = (geometry) => {
1133
1133
  const isHitLineText = (board, element, point) => {
1134
1134
  return getHitLineTextIndex(board, element, point) !== -1;
1135
1135
  };
1136
- const isHitPolyLine = (pathPoints, point, strokeWidth, expand = 0) => {
1136
+ const isHitPolyLine = (pathPoints, point) => {
1137
1137
  const distance = distanceBetweenPointAndSegments(pathPoints, point);
1138
- return distance <= strokeWidth + expand;
1138
+ return distance <= HIT_DISTANCE_BUFFER;
1139
+ };
1140
+ const isHitLine = (board, element, point) => {
1141
+ const points = getLinePoints(board, element);
1142
+ const isHitText = isHitLineText(board, element, point);
1143
+ return isHitText || isHitPolyLine(points, point);
1139
1144
  };
1140
1145
  const isRectangleHitDrawElement = (board, element, selection) => {
1141
1146
  const rangeRectangle = RectangleClient.getRectangleByPoints([selection.anchor, selection.focus]);
@@ -1153,23 +1158,27 @@ const isRectangleHitDrawElement = (board, element, selection) => {
1153
1158
  }
1154
1159
  if (PlaitDrawElement.isLine(element)) {
1155
1160
  const points = getLinePoints(board, element);
1156
- const strokeWidth = getStrokeWidthByElement(element);
1157
- const isHitText = isHitLineText(board, element, selection.focus);
1158
- const isHit = isHitPolyLine(points, selection.focus, strokeWidth, 3) || isHitText;
1159
- const isContainPolyLinePoint = points.some(point => {
1160
- return RectangleClient.isHit(rangeRectangle, RectangleClient.getRectangleByPoints([point, point]));
1161
- });
1162
- const isIntersect = Point.isEquals(selection.anchor, selection.focus) ? isHit : isPolylineHitRectangle(points, rangeRectangle);
1163
- return isContainPolyLinePoint || isIntersect;
1161
+ return isPolylineHitRectangle(points, rangeRectangle);
1164
1162
  }
1165
1163
  return null;
1166
1164
  };
1167
1165
  const isHitDrawElement = (board, element, point) => {
1168
1166
  if (PlaitDrawElement.isGeometry(element)) {
1169
1167
  const fill = getFillByElement(board, element);
1168
+ const engine = getEngine(getShape(element));
1169
+ const rectangle = board.getRectangle(element);
1170
+ const nearestPoint = engine.getNearestPoint(rectangle, point);
1171
+ const distance = distanceBetweenPointAndPoint(nearestPoint[0], nearestPoint[1], point[0], point[1]);
1172
+ const isHitEdge = distance <= HIT_DISTANCE_BUFFER;
1173
+ if (isHitEdge) {
1174
+ return isHitEdge;
1175
+ }
1170
1176
  // when shape equals text, fill is not allowed
1171
1177
  if (fill !== DefaultGeometryStyle.fill && fill !== TRANSPARENT && !PlaitDrawElement.isText(element)) {
1172
- return isRectangleHitDrawElement(board, element, { anchor: point, focus: point });
1178
+ const isHitInside = engine.isInsidePoint(rectangle, point);
1179
+ if (isHitInside) {
1180
+ return isHitInside;
1181
+ }
1173
1182
  }
1174
1183
  else {
1175
1184
  // if shape equals text, only check text rectangle
@@ -1178,18 +1187,44 @@ const isHitDrawElement = (board, element, point) => {
1178
1187
  let isHitText = RectangleClient.isPointInRectangle(textClient, point);
1179
1188
  return isHitText;
1180
1189
  }
1181
- const strokeWidth = getStrokeWidthByElement(element);
1182
- const engine = getEngine(getShape(element));
1183
- const corners = engine.getCornerPoints(RectangleClient.getRectangleByPoints(element.points));
1184
- const isHit = isHitPolyLine(corners, point, strokeWidth, 3);
1185
- const textClient = getTextRectangle(element);
1186
- let isHitText = RectangleClient.isPointInRectangle(textClient, point);
1187
- return isHit || isHitText;
1190
+ // check textRectangle of element
1191
+ const textClient = engine.getTextRectangle ? engine.getTextRectangle(element) : getTextRectangle(element);
1192
+ const isHitTextRectangle = RectangleClient.isPointInRectangle(textClient, point);
1193
+ if (isHitTextRectangle) {
1194
+ return isHitTextRectangle;
1195
+ }
1196
+ }
1197
+ }
1198
+ if (PlaitDrawElement.isImage(element)) {
1199
+ return isRectangleHitDrawElement(board, element, { anchor: point, focus: point });
1200
+ }
1201
+ if (PlaitDrawElement.isLine(element)) {
1202
+ return isHitLine(board, element, point);
1203
+ }
1204
+ return null;
1205
+ };
1206
+ const isHitElementInside = (board, element, point) => {
1207
+ if (PlaitDrawElement.isGeometry(element)) {
1208
+ const engine = getEngine(getShape(element));
1209
+ const rectangle = board.getRectangle(element);
1210
+ const isHitInside = engine.isInsidePoint(rectangle, point);
1211
+ if (isHitInside) {
1212
+ return isHitInside;
1213
+ }
1214
+ if (engine.getTextRectangle) {
1215
+ const textClient = engine.getTextRectangle(element);
1216
+ const isHitTextRectangle = RectangleClient.isPointInRectangle(textClient, point);
1217
+ if (isHitTextRectangle) {
1218
+ return isHitTextRectangle;
1219
+ }
1188
1220
  }
1189
1221
  }
1190
- if (PlaitDrawElement.isImage(element) || PlaitDrawElement.isLine(element)) {
1222
+ if (PlaitDrawElement.isImage(element)) {
1191
1223
  return isRectangleHitDrawElement(board, element, { anchor: point, focus: point });
1192
1224
  }
1225
+ if (PlaitDrawElement.isLine(element)) {
1226
+ return isHitLine(board, element, point);
1227
+ }
1193
1228
  return null;
1194
1229
  };
1195
1230
 
@@ -1231,7 +1266,7 @@ const CommentEngine = {
1231
1266
  setStrokeLinecap(polygon, 'round');
1232
1267
  return polygon;
1233
1268
  },
1234
- isHit(rectangle, point) {
1269
+ isInsidePoint(rectangle, point) {
1235
1270
  const parallelogramPoints = getCommentPoints(rectangle);
1236
1271
  return isPointInPolygon(point, parallelogramPoints);
1237
1272
  },
@@ -1284,7 +1319,7 @@ function createPolygonEngine(options) {
1284
1319
  setStrokeLinecap(polygon, 'round');
1285
1320
  return polygon;
1286
1321
  },
1287
- isHit(rectangle, point) {
1322
+ isInsidePoint(rectangle, point) {
1288
1323
  const points = getPoints(rectangle);
1289
1324
  return isPointInPolygon(point, points);
1290
1325
  },
@@ -1377,7 +1412,7 @@ const EllipseEngine = {
1377
1412
  const rs = PlaitBoard.getRoughSVG(board);
1378
1413
  return rs.ellipse(centerPoint[0], centerPoint[1], rectangle.width, rectangle.height, { ...options, fillStyle: 'solid' });
1379
1414
  },
1380
- isHit(rectangle, point) {
1415
+ isInsidePoint(rectangle, point) {
1381
1416
  const centerPoint = [rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height / 2];
1382
1417
  return isPointInEllipse(point, centerPoint, rectangle.width / 2, rectangle.height / 2);
1383
1418
  },
@@ -1620,7 +1655,7 @@ const RectangleEngine = {
1620
1655
  draw(board, rectangle, options) {
1621
1656
  return drawRectangle(board, rectangle, { ...options, fillStyle: 'solid' });
1622
1657
  },
1623
- isHit(rectangle, point) {
1658
+ isInsidePoint(rectangle, point) {
1624
1659
  const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
1625
1660
  return RectangleClient.isHit(rectangle, rangeRectangle);
1626
1661
  },
@@ -1670,7 +1705,7 @@ const RoundRectangleEngine = {
1670
1705
  draw(board, rectangle, options) {
1671
1706
  return drawRoundRectangle(PlaitBoard.getRoughSVG(board), rectangle.x, rectangle.y, rectangle.x + rectangle.width, rectangle.y + rectangle.height, { ...options, fillStyle: 'solid' }, false, getRoundRectangleRadius(rectangle));
1672
1707
  },
1673
- isHit(rectangle, point) {
1708
+ isInsidePoint(rectangle, point) {
1674
1709
  return isPointInRoundRectangle(point, rectangle, getRoundRectangleRadius(rectangle));
1675
1710
  },
1676
1711
  getCornerPoints(rectangle) {
@@ -1743,7 +1778,7 @@ const RoundCommentEngine = {
1743
1778
  const point11 = [x1 + rectangle.width / 2, y2];
1744
1779
  return rs.path(`M${point2[0]} ${point2[1]} A ${radius} ${radius}, 0, 0, 1, ${point3[0]} ${point3[1]} L ${point4[0]} ${point4[1]} A ${radius} ${radius}, 0, 0, 1, ${point5[0]} ${point5[1]} L ${point11[0]} ${point11[1]} ${point10[0]} ${point10[1]} ${point9[0]} ${point9[1]} ${point6[0]} ${point6[1]} A ${radius} ${radius}, 0, 0, 1, ${point7[0]} ${point7[1]} L ${point8[0]} ${point8[1]} A ${radius} ${radius}, 0, 0, 1, ${point1[0]} ${point1[1]} Z`, { ...options, fillStyle: 'solid' });
1745
1780
  },
1746
- isHit(rectangle, point) {
1781
+ isInsidePoint(rectangle, point) {
1747
1782
  const points = [
1748
1783
  [rectangle.x + rectangle.width / 4, rectangle.y + (rectangle.height * 3) / 4],
1749
1784
  [rectangle.x + rectangle.width / 4, rectangle.y + rectangle.height],
@@ -1911,7 +1946,7 @@ const TerminalEngine = {
1911
1946
  draw(board, rectangle, options) {
1912
1947
  return drawRoundRectangle(PlaitBoard.getRoughSVG(board), rectangle.x, rectangle.y, rectangle.x + rectangle.width, rectangle.y + rectangle.height, { ...options, fillStyle: 'solid' }, false, getStartEndRadius(rectangle));
1913
1948
  },
1914
- isHit(rectangle, point) {
1949
+ isInsidePoint(rectangle, point) {
1915
1950
  return isPointInRoundRectangle(point, rectangle, getStartEndRadius(rectangle));
1916
1951
  },
1917
1952
  getCornerPoints(rectangle) {
@@ -2086,7 +2121,7 @@ const DelayEngine = {
2086
2121
  setStrokeLinecap(shape, 'round');
2087
2122
  return shape;
2088
2123
  },
2089
- isHit(rectangle, point) {
2124
+ isInsidePoint(rectangle, point) {
2090
2125
  //split shape to rectangle and a half ellipse
2091
2126
  const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
2092
2127
  const isInRectangle = RectangleClient.isHit({
@@ -2130,7 +2165,7 @@ const StoredDataEngine = {
2130
2165
  setStrokeLinecap(shape, 'round');
2131
2166
  return shape;
2132
2167
  },
2133
- isHit(rectangle, point) {
2168
+ isInsidePoint(rectangle, point) {
2134
2169
  //split shape to rectangle and a half ellipse
2135
2170
  const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
2136
2171
  const isInRectangle = RectangleClient.isHit({
@@ -3101,10 +3136,10 @@ class GeometryComponent extends CommonPluginElement {
3101
3136
  this.activeGenerator.destroy();
3102
3137
  this.lineAutoCompleteGenerator.destroy();
3103
3138
  }
3104
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.8", ngImport: i0, type: GeometryComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
3105
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.8", type: GeometryComponent, isStandalone: true, selector: "plait-draw-geometry", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3139
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GeometryComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
3140
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: GeometryComponent, isStandalone: true, selector: "plait-draw-geometry", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3106
3141
  }
3107
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.8", ngImport: i0, type: GeometryComponent, decorators: [{
3142
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GeometryComponent, decorators: [{
3108
3143
  type: Component,
3109
3144
  args: [{
3110
3145
  selector: 'plait-draw-geometry',
@@ -3346,10 +3381,10 @@ class LineComponent extends CommonPluginElement {
3346
3381
  this.destroy$.complete();
3347
3382
  this.destroyTextManages();
3348
3383
  }
3349
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.8", ngImport: i0, type: LineComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
3350
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.8", type: LineComponent, isStandalone: true, selector: "plait-draw-line", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3384
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LineComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
3385
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: LineComponent, isStandalone: true, selector: "plait-draw-line", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
3351
3386
  }
3352
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.8", ngImport: i0, type: LineComponent, decorators: [{
3387
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LineComponent, decorators: [{
3353
3388
  type: Component,
3354
3389
  args: [{
3355
3390
  selector: 'plait-draw-line',
@@ -4580,10 +4615,10 @@ class ImageComponent extends CommonPluginElement {
4580
4615
  this.imageGenerator.destroy();
4581
4616
  this.lineAutoCompleteGenerator.destroy();
4582
4617
  }
4583
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.8", ngImport: i0, type: ImageComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
4584
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.8", type: ImageComponent, isStandalone: true, selector: "plait-draw-geometry", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4618
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ImageComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
4619
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ImageComponent, isStandalone: true, selector: "plait-draw-geometry", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4585
4620
  }
4586
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.8", ngImport: i0, type: ImageComponent, decorators: [{
4621
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ImageComponent, decorators: [{
4587
4622
  type: Component,
4588
4623
  args: [{
4589
4624
  selector: 'plait-draw-geometry',
@@ -4738,7 +4773,7 @@ const withLineTextMove = (board) => {
4738
4773
  };
4739
4774
 
4740
4775
  const withDraw = (board) => {
4741
- const { drawElement, getRectangle, isRectangleHit, isHit, isMovable, isAlign, getRelatedFragment } = board;
4776
+ const { drawElement, getRectangle, isRectangleHit, isHit, isInsidePoint, isMovable, isAlign, getRelatedFragment } = board;
4742
4777
  board.drawElement = (context) => {
4743
4778
  if (PlaitDrawElement.isGeometry(context.element)) {
4744
4779
  return GeometryComponent;
@@ -4783,6 +4818,13 @@ const withDraw = (board) => {
4783
4818
  }
4784
4819
  return isHit(element, point);
4785
4820
  };
4821
+ board.isInsidePoint = (element, point) => {
4822
+ const result = isHitElementInside(board, element, point);
4823
+ if (result !== null) {
4824
+ return result;
4825
+ }
4826
+ return isInsidePoint(element, point);
4827
+ };
4786
4828
  board.isMovable = (element) => {
4787
4829
  if (PlaitDrawElement.isGeometry(element)) {
4788
4830
  return true;
@@ -4832,5 +4874,5 @@ const withDraw = (board) => {
4832
4874
  * Generated bundle index. Do not edit.
4833
4875
  */
4834
4876
 
4835
- export { BasicShapes, DEFAULT_IMAGE_WIDTH, DefaultBasicShapeProperty, DefaultConnectorProperty, DefaultDataProperty, DefaultDecisionProperty, DefaultFlowchartProperty, DefaultFlowchartPropertyMap, DefaultGeometryActiveStyle, DefaultGeometryStyle, DefaultManualInputProperty, DefaultMergeProperty, DefaultTextProperty, DrawThemeColors, DrawTransforms, FlowchartSymbols, GeometryComponent, GeometryThreshold, LineComponent, LineHandleKey, LineMarkerType, LineShape, MemorizeKey, PlaitDrawElement, PlaitGeometry, PlaitLine, Q2C, REACTION_MARGIN, ShapeDefaultSpace, StrokeStyle, WithLineAutoCompletePluginKey, alignElbowSegment, alignPoints, createDefaultFlowchart, createDefaultGeometry, createGeometryElement, createLineElement, createTextElement, drawBoundMask, drawGeometry, drawLine, drawLineArrow, getAutoCompletePoints, getBasicPointers, getCenterPointsOnPolygon, getConnectionByNearestPoint, getConnectionPoint, getCurvePoints, getDefaultFlowchartProperty, getDefaultGeometryPoints, getDefaultGeometryProperty, getDefaultTextPoints, getDrawDefaultStrokeColor, getElbowLineRouteOptions, getElbowPoints, getFillByElement, getFlowchartDefaultFill, getFlowchartPointers, getGeometryPointers, getHitConnectorPoint, getHitIndexOfAutoCompletePoint, getIndexAndDeleteCountByKeyPoint, getLineDashByElement, getLineHandleRefPair, getLineMemorizedLatest, getLinePointers, getLinePoints, getLineTextRectangle, getLines, getMemorizeKey, getMemorizedLatestByPointer, getMemorizedLatestShape, getMidKeyPoints, getMiddlePoints, getMirrorDataPoints, getNearestPoint, getNextRenderPoints, getNextSourceAndTargetPoints, getResizedPreviousAndNextPoint, getSelectedDrawElements, getSelectedGeometryElements, getSelectedImageElements, getSelectedLineElements, getSourceAndTargetRectangle, getStrokeColorByElement, getStrokeStyleByElement, getStrokeWidthByElement, getTextRectangle, getTextShapeProperty, getVectorByConnection, handleLineCreating, hasIllegalElbowPoint, insertElement, isHitDrawElement, isHitLineText, isHitPolyLine, isRectangleHitDrawElement, isTextExceedingBounds, isUpdatedHandleIndex, memorizeLatestShape, memorizeLatestText, withDraw, withLineAutoComplete };
4877
+ export { BasicShapes, DEFAULT_IMAGE_WIDTH, DefaultBasicShapeProperty, DefaultConnectorProperty, DefaultDataProperty, DefaultDecisionProperty, DefaultFlowchartProperty, DefaultFlowchartPropertyMap, DefaultGeometryActiveStyle, DefaultGeometryStyle, DefaultManualInputProperty, DefaultMergeProperty, DefaultTextProperty, DrawThemeColors, DrawTransforms, FlowchartSymbols, GeometryComponent, GeometryThreshold, LineComponent, LineHandleKey, LineMarkerType, LineShape, MemorizeKey, PlaitDrawElement, PlaitGeometry, PlaitLine, Q2C, REACTION_MARGIN, ShapeDefaultSpace, StrokeStyle, WithLineAutoCompletePluginKey, alignElbowSegment, alignPoints, createDefaultFlowchart, createDefaultGeometry, createGeometryElement, createLineElement, createTextElement, drawBoundMask, drawGeometry, drawLine, drawLineArrow, getAutoCompletePoints, getBasicPointers, getCenterPointsOnPolygon, getConnectionByNearestPoint, getConnectionPoint, getCurvePoints, getDefaultFlowchartProperty, getDefaultGeometryPoints, getDefaultGeometryProperty, getDefaultTextPoints, getDrawDefaultStrokeColor, getElbowLineRouteOptions, getElbowPoints, getFillByElement, getFlowchartDefaultFill, getFlowchartPointers, getGeometryPointers, getHitConnectorPoint, getHitIndexOfAutoCompletePoint, getIndexAndDeleteCountByKeyPoint, getLineDashByElement, getLineHandleRefPair, getLineMemorizedLatest, getLinePointers, getLinePoints, getLineTextRectangle, getLines, getMemorizeKey, getMemorizedLatestByPointer, getMemorizedLatestShape, getMidKeyPoints, getMiddlePoints, getMirrorDataPoints, getNearestPoint, getNextRenderPoints, getNextSourceAndTargetPoints, getResizedPreviousAndNextPoint, getSelectedDrawElements, getSelectedGeometryElements, getSelectedImageElements, getSelectedLineElements, getSourceAndTargetRectangle, getStrokeColorByElement, getStrokeStyleByElement, getStrokeWidthByElement, getTextRectangle, getTextShapeProperty, getVectorByConnection, handleLineCreating, hasIllegalElbowPoint, insertElement, isHitDrawElement, isHitElementInside, isHitLine, isHitLineText, isHitPolyLine, isRectangleHitDrawElement, isTextExceedingBounds, isUpdatedHandleIndex, memorizeLatestShape, memorizeLatestText, withDraw, withLineAutoComplete };
4836
4878
  //# sourceMappingURL=plait-draw.mjs.map