@plait/draw 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.
@@ -1,5 +1,5 @@
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';
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';
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, getRectangleByGroup, getElementsInGroup, isSelectedElementOrGroup, PlaitGroupElement } from '@plait/core';
2
+ import { removeDuplicatePoints, generateElbowLineRoute, simplifyOrthogonalPoints, isSourceAndTargetIntersect, getPoints, getPointByVector, getExtendPoint, getUnitVectorByPointAndPoint, Generator, getRectangleResizeHandleRefs, RESIZE_HANDLE_DIAMETER, getMemorizedLatest, memorizeLatest, getPointOnPolyline, rotatePoints, 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, getDirectionFactorByDirectionComponent, 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';
5
5
  import * as i0 from '@angular/core';
@@ -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,43 +1133,59 @@ 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]);
1142
1147
  if (PlaitDrawElement.isGeometry(element)) {
1143
1148
  const client = RectangleClient.getRectangleByPoints(element.points);
1149
+ const centerPoint = RectangleClient.getCenterPoint(client);
1150
+ let rotatedCornerPoints = rotatePoints(RectangleClient.getCornerPoints(client), centerPoint, element.angle);
1144
1151
  if (isTextExceedingBounds(element)) {
1145
1152
  const textClient = getTextRectangle(element);
1146
- return RectangleClient.isHit(rangeRectangle, client) || RectangleClient.isHit(rangeRectangle, textClient);
1153
+ rotatedCornerPoints = rotatePoints(RectangleClient.getCornerPoints(textClient), centerPoint, element.angle);
1147
1154
  }
1148
- return RectangleClient.isHit(rangeRectangle, client);
1155
+ return isPolylineHitRectangle(rotatedCornerPoints, rangeRectangle);
1149
1156
  }
1150
1157
  if (PlaitDrawElement.isImage(element)) {
1151
1158
  const client = RectangleClient.getRectangleByPoints(element.points);
1152
- return RectangleClient.isHit(rangeRectangle, client);
1159
+ const rotatedCornerPoints = rotatePoints(RectangleClient.getCornerPoints(client), RectangleClient.getCenterPoint(client), element.angle);
1160
+ return isPolylineHitRectangle(rotatedCornerPoints, client);
1153
1161
  }
1154
1162
  if (PlaitDrawElement.isLine(element)) {
1155
1163
  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;
1164
+ return isPolylineHitRectangle(points, rangeRectangle);
1164
1165
  }
1165
1166
  return null;
1166
1167
  };
1167
1168
  const isHitDrawElement = (board, element, point) => {
1169
+ const rectangle = board.getRectangle(element);
1170
+ const centerPoint = RectangleClient.getCenterPoint(rectangle);
1171
+ if (element.angle) {
1172
+ point = rotate(point[0], point[1], centerPoint[0], centerPoint[1], -element.angle);
1173
+ }
1168
1174
  if (PlaitDrawElement.isGeometry(element)) {
1169
1175
  const fill = getFillByElement(board, element);
1176
+ const engine = getEngine(getShape(element));
1177
+ const nearestPoint = engine.getNearestPoint(rectangle, point);
1178
+ const distance = distanceBetweenPointAndPoint(nearestPoint[0], nearestPoint[1], point[0], point[1]);
1179
+ const isHitEdge = distance <= HIT_DISTANCE_BUFFER;
1180
+ if (isHitEdge) {
1181
+ return isHitEdge;
1182
+ }
1170
1183
  // when shape equals text, fill is not allowed
1171
1184
  if (fill !== DefaultGeometryStyle.fill && fill !== TRANSPARENT && !PlaitDrawElement.isText(element)) {
1172
- return isRectangleHitDrawElement(board, element, { anchor: point, focus: point });
1185
+ const isHitInside = engine.isInsidePoint(rectangle, point);
1186
+ if (isHitInside) {
1187
+ return isHitInside;
1188
+ }
1173
1189
  }
1174
1190
  else {
1175
1191
  // if shape equals text, only check text rectangle
@@ -1178,18 +1194,48 @@ const isHitDrawElement = (board, element, point) => {
1178
1194
  let isHitText = RectangleClient.isPointInRectangle(textClient, point);
1179
1195
  return isHitText;
1180
1196
  }
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;
1197
+ // check textRectangle of element
1198
+ const textClient = engine.getTextRectangle ? engine.getTextRectangle(element) : getTextRectangle(element);
1199
+ const isHitTextRectangle = RectangleClient.isPointInRectangle(textClient, point);
1200
+ if (isHitTextRectangle) {
1201
+ return isHitTextRectangle;
1202
+ }
1188
1203
  }
1189
1204
  }
1190
- if (PlaitDrawElement.isImage(element) || PlaitDrawElement.isLine(element)) {
1205
+ if (PlaitDrawElement.isImage(element)) {
1191
1206
  return isRectangleHitDrawElement(board, element, { anchor: point, focus: point });
1192
1207
  }
1208
+ if (PlaitDrawElement.isLine(element)) {
1209
+ return isHitLine(board, element, point);
1210
+ }
1211
+ return null;
1212
+ };
1213
+ const isHitElementInside = (board, element, point) => {
1214
+ const rectangle = board.getRectangle(element);
1215
+ const centerPoint = RectangleClient.getCenterPoint(rectangle);
1216
+ if (element.angle) {
1217
+ point = rotate(point[0], point[1], centerPoint[0], centerPoint[1], -element.angle);
1218
+ }
1219
+ if (PlaitDrawElement.isGeometry(element)) {
1220
+ const engine = getEngine(getShape(element));
1221
+ const isHitInside = engine.isInsidePoint(rectangle, point);
1222
+ if (isHitInside) {
1223
+ return isHitInside;
1224
+ }
1225
+ if (engine.getTextRectangle) {
1226
+ const textClient = engine.getTextRectangle(element);
1227
+ const isHitTextRectangle = RectangleClient.isPointInRectangle(textClient, point);
1228
+ if (isHitTextRectangle) {
1229
+ return isHitTextRectangle;
1230
+ }
1231
+ }
1232
+ }
1233
+ if (PlaitDrawElement.isImage(element)) {
1234
+ return isRectangleHitDrawElement(board, element, { anchor: point, focus: point });
1235
+ }
1236
+ if (PlaitDrawElement.isLine(element)) {
1237
+ return isHitLine(board, element, point);
1238
+ }
1193
1239
  return null;
1194
1240
  };
1195
1241
 
@@ -1231,7 +1277,7 @@ const CommentEngine = {
1231
1277
  setStrokeLinecap(polygon, 'round');
1232
1278
  return polygon;
1233
1279
  },
1234
- isHit(rectangle, point) {
1280
+ isInsidePoint(rectangle, point) {
1235
1281
  const parallelogramPoints = getCommentPoints(rectangle);
1236
1282
  return isPointInPolygon(point, parallelogramPoints);
1237
1283
  },
@@ -1284,7 +1330,7 @@ function createPolygonEngine(options) {
1284
1330
  setStrokeLinecap(polygon, 'round');
1285
1331
  return polygon;
1286
1332
  },
1287
- isHit(rectangle, point) {
1333
+ isInsidePoint(rectangle, point) {
1288
1334
  const points = getPoints(rectangle);
1289
1335
  return isPointInPolygon(point, points);
1290
1336
  },
@@ -1377,7 +1423,7 @@ const EllipseEngine = {
1377
1423
  const rs = PlaitBoard.getRoughSVG(board);
1378
1424
  return rs.ellipse(centerPoint[0], centerPoint[1], rectangle.width, rectangle.height, { ...options, fillStyle: 'solid' });
1379
1425
  },
1380
- isHit(rectangle, point) {
1426
+ isInsidePoint(rectangle, point) {
1381
1427
  const centerPoint = [rectangle.x + rectangle.width / 2, rectangle.y + rectangle.height / 2];
1382
1428
  return isPointInEllipse(point, centerPoint, rectangle.width / 2, rectangle.height / 2);
1383
1429
  },
@@ -1620,7 +1666,7 @@ const RectangleEngine = {
1620
1666
  draw(board, rectangle, options) {
1621
1667
  return drawRectangle(board, rectangle, { ...options, fillStyle: 'solid' });
1622
1668
  },
1623
- isHit(rectangle, point) {
1669
+ isInsidePoint(rectangle, point) {
1624
1670
  const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
1625
1671
  return RectangleClient.isHit(rectangle, rangeRectangle);
1626
1672
  },
@@ -1670,7 +1716,7 @@ const RoundRectangleEngine = {
1670
1716
  draw(board, rectangle, options) {
1671
1717
  return drawRoundRectangle(PlaitBoard.getRoughSVG(board), rectangle.x, rectangle.y, rectangle.x + rectangle.width, rectangle.y + rectangle.height, { ...options, fillStyle: 'solid' }, false, getRoundRectangleRadius(rectangle));
1672
1718
  },
1673
- isHit(rectangle, point) {
1719
+ isInsidePoint(rectangle, point) {
1674
1720
  return isPointInRoundRectangle(point, rectangle, getRoundRectangleRadius(rectangle));
1675
1721
  },
1676
1722
  getCornerPoints(rectangle) {
@@ -1743,7 +1789,7 @@ const RoundCommentEngine = {
1743
1789
  const point11 = [x1 + rectangle.width / 2, y2];
1744
1790
  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
1791
  },
1746
- isHit(rectangle, point) {
1792
+ isInsidePoint(rectangle, point) {
1747
1793
  const points = [
1748
1794
  [rectangle.x + rectangle.width / 4, rectangle.y + (rectangle.height * 3) / 4],
1749
1795
  [rectangle.x + rectangle.width / 4, rectangle.y + rectangle.height],
@@ -1911,7 +1957,7 @@ const TerminalEngine = {
1911
1957
  draw(board, rectangle, options) {
1912
1958
  return drawRoundRectangle(PlaitBoard.getRoughSVG(board), rectangle.x, rectangle.y, rectangle.x + rectangle.width, rectangle.y + rectangle.height, { ...options, fillStyle: 'solid' }, false, getStartEndRadius(rectangle));
1913
1959
  },
1914
- isHit(rectangle, point) {
1960
+ isInsidePoint(rectangle, point) {
1915
1961
  return isPointInRoundRectangle(point, rectangle, getStartEndRadius(rectangle));
1916
1962
  },
1917
1963
  getCornerPoints(rectangle) {
@@ -2086,7 +2132,7 @@ const DelayEngine = {
2086
2132
  setStrokeLinecap(shape, 'round');
2087
2133
  return shape;
2088
2134
  },
2089
- isHit(rectangle, point) {
2135
+ isInsidePoint(rectangle, point) {
2090
2136
  //split shape to rectangle and a half ellipse
2091
2137
  const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
2092
2138
  const isInRectangle = RectangleClient.isHit({
@@ -2130,7 +2176,7 @@ const StoredDataEngine = {
2130
2176
  setStrokeLinecap(shape, 'round');
2131
2177
  return shape;
2132
2178
  },
2133
- isHit(rectangle, point) {
2179
+ isInsidePoint(rectangle, point) {
2134
2180
  //split shape to rectangle and a half ellipse
2135
2181
  const rangeRectangle = RectangleClient.getRectangleByPoints([point, point]);
2136
2182
  const isInRectangle = RectangleClient.isHit({
@@ -3055,10 +3101,14 @@ class GeometryComponent extends CommonPluginElement {
3055
3101
  drawText() {
3056
3102
  this.textManage.draw(this.element.text);
3057
3103
  this.g.append(this.textManage.g);
3104
+ const centerPoint = RectangleClient.getCenterPoint(this.board.getRectangle(this.element));
3105
+ this.textManage.updateAngle(centerPoint, this.element.angle);
3058
3106
  }
3059
3107
  updateText() {
3060
3108
  this.textManage.updateText(this.element.text);
3061
3109
  this.textManage.updateRectangle();
3110
+ const centerPoint = RectangleClient.getCenterPoint(this.board.getRectangle(this.element));
3111
+ this.textManage.updateAngle(centerPoint, this.element.angle);
3062
3112
  }
3063
3113
  initializeTextManage() {
3064
3114
  const plugins = (this.board.getPluginOptions(WithTextPluginKey) || {}).textPlugins;
@@ -4066,7 +4116,7 @@ function getResizeAlignRef(board, resizeRef, resizeState, resizeOriginPointAndHa
4066
4116
  activeRectangle,
4067
4117
  originPoint,
4068
4118
  handlePoint,
4069
- directionFactors: [getDirectionFactorByVectorComponent(x), getDirectionFactorByVectorComponent(y)],
4119
+ directionFactors: [getDirectionFactorByDirectionComponent(x), getDirectionFactorByDirectionComponent(y)],
4070
4120
  isAspectRatio,
4071
4121
  isFromCorner
4072
4122
  });
@@ -4737,8 +4787,68 @@ const withLineTextMove = (board) => {
4737
4787
  return board;
4738
4788
  };
4739
4789
 
4790
+ class GroupGenerator extends Generator {
4791
+ canDraw(element) {
4792
+ return true;
4793
+ }
4794
+ draw(element, partialSelected) {
4795
+ const options = {
4796
+ stroke: '',
4797
+ strokeWidth: ACTIVE_STROKE_WIDTH,
4798
+ strokeLineDash: [5]
4799
+ };
4800
+ if (partialSelected) {
4801
+ options.stroke = '#999';
4802
+ }
4803
+ const rectangle = getRectangleByGroup(this.board, element, true);
4804
+ return drawRectangle(this.board, rectangle, options);
4805
+ }
4806
+ }
4807
+
4808
+ class GroupComponent extends CommonPluginElement {
4809
+ constructor(viewContainerRef, cdr) {
4810
+ super(cdr);
4811
+ this.viewContainerRef = viewContainerRef;
4812
+ this.cdr = cdr;
4813
+ }
4814
+ initializeGenerator() {
4815
+ this.activeGenerator = new ActiveGenerator(this.board, {
4816
+ getRectangle: (element) => {
4817
+ return getRectangleByGroup(this.board, element);
4818
+ },
4819
+ getStrokeWidth: () => 0,
4820
+ getStrokeOpacity: () => 0,
4821
+ hasResizeHandle: () => {
4822
+ return !isSelectionMoving(this.board);
4823
+ }
4824
+ });
4825
+ this.groupGenerator = new GroupGenerator(this.board);
4826
+ }
4827
+ ngOnInit() {
4828
+ super.ngOnInit();
4829
+ this.initializeGenerator();
4830
+ }
4831
+ onContextChanged(value, previous) {
4832
+ const elementsInGroup = getElementsInGroup(this.board, value.element, false, true);
4833
+ const isPartialSelectGroup = elementsInGroup.some(item => isSelectedElementOrGroup(this.board, item)) &&
4834
+ !elementsInGroup.every(item => isSelectedElementOrGroup(this.board, item));
4835
+ this.groupGenerator.processDrawing(value.element, this.g, isPartialSelectGroup);
4836
+ }
4837
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.8", ngImport: i0, type: GroupComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
4838
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.8", type: GroupComponent, isStandalone: true, selector: "plait-group", usesInheritance: true, ngImport: i0, template: ``, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
4839
+ }
4840
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.8", ngImport: i0, type: GroupComponent, decorators: [{
4841
+ type: Component,
4842
+ args: [{
4843
+ selector: 'plait-group',
4844
+ template: ``,
4845
+ changeDetection: ChangeDetectionStrategy.OnPush,
4846
+ standalone: true
4847
+ }]
4848
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }]; } });
4849
+
4740
4850
  const withDraw = (board) => {
4741
- const { drawElement, getRectangle, isRectangleHit, isHit, isMovable, isAlign, getRelatedFragment } = board;
4851
+ const { drawElement, getRectangle, isRectangleHit, isHit, isInsidePoint, isMovable, isAlign, getRelatedFragment } = board;
4742
4852
  board.drawElement = (context) => {
4743
4853
  if (PlaitDrawElement.isGeometry(context.element)) {
4744
4854
  return GeometryComponent;
@@ -4749,6 +4859,9 @@ const withDraw = (board) => {
4749
4859
  else if (PlaitDrawElement.isImage(context.element)) {
4750
4860
  return ImageComponent;
4751
4861
  }
4862
+ else if (PlaitGroupElement.isGroup(context.element)) {
4863
+ return GroupComponent;
4864
+ }
4752
4865
  return drawElement(context);
4753
4866
  };
4754
4867
  board.getRectangle = (element) => {
@@ -4767,6 +4880,9 @@ const withDraw = (board) => {
4767
4880
  if (PlaitDrawElement.isImage(element)) {
4768
4881
  return RectangleClient.getRectangleByPoints(element.points);
4769
4882
  }
4883
+ if (PlaitGroupElement.isGroup(element)) {
4884
+ return getRectangleByGroup(board, element);
4885
+ }
4770
4886
  return getRectangle(element);
4771
4887
  };
4772
4888
  board.isRectangleHit = (element, selection) => {
@@ -4783,6 +4899,13 @@ const withDraw = (board) => {
4783
4899
  }
4784
4900
  return isHit(element, point);
4785
4901
  };
4902
+ board.isInsidePoint = (element, point) => {
4903
+ const result = isHitElementInside(board, element, point);
4904
+ if (result !== null) {
4905
+ return result;
4906
+ }
4907
+ return isInsidePoint(element, point);
4908
+ };
4786
4909
  board.isMovable = (element) => {
4787
4910
  if (PlaitDrawElement.isGeometry(element)) {
4788
4911
  return true;
@@ -4832,5 +4955,5 @@ const withDraw = (board) => {
4832
4955
  * Generated bundle index. Do not edit.
4833
4956
  */
4834
4957
 
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 };
4958
+ 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
4959
  //# sourceMappingURL=plait-draw.mjs.map