@plait/draw 0.67.2 → 0.69.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.
- package/esm2022/plugins/with-arrow-line-create.mjs +2 -4
- package/esm2022/plugins/with-draw-rotate.mjs +2 -3
- package/esm2022/plugins/with-geometry-create.mjs +2 -5
- package/esm2022/plugins/with-swimlane-create.mjs +2 -4
- package/esm2022/plugins/with-vector-pen-create.mjs +2 -3
- package/esm2022/transforms/table.mjs +15 -9
- package/fesm2022/plait-draw.mjs +15 -18
- package/fesm2022/plait-draw.mjs.map +1 -1
- package/package.json +1 -1
- package/transforms/index.d.ts +1 -1
- package/transforms/table.d.ts +1 -1
- package/utils/clipboard.d.ts +1 -1
package/fesm2022/plait-draw.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ACTIVE_STROKE_WIDTH, DEFAULT_COLOR, ThemeColorMode, RectangleClient, getSelectedElements, idCreator, catmullRomFitting, PlaitBoard, createG, drawLinearPath, setStrokeLinecap, distanceBetweenPointAndSegments, HIT_DISTANCE_BUFFER, isPointInPolygon, rotatePointsByElement, isPolylineHitRectangle, rotateAntiPointsByElement, distanceBetweenPointAndPoint, Transforms, clearSelectedElement, addSelectedElement, BoardTransforms, PlaitPointerType, depthFirstRecursion, getIsRecursionFunc, SNAPPING_STROKE_WIDTH, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, drawCircle, createDebugGenerator, Point, arrowPoints, createPath, rotate, findElements, createMask, createRect, PlaitElement, getElementById, PlaitNode, hasValidAngle, toViewBoxPoint, toHostPoint, Direction, rotatePoints, getRectangleByElements, getSelectionAngle, rotatedDataPoints, isAxisChangedByAngle, isSelectionMoving, drawRectangle, getRectangleByAngle, getSnapRectangles, getTripleAxis, getMinPointDelta, SNAP_TOLERANCE, drawPointSnapLines, drawSolidLines, getNearestPointBetweenPointAndSegments, isPointInEllipse, getNearestPointBetweenPointAndEllipse, getEllipseTangentSlope, getVectorFromPointAndSlope, drawRoundRectangle, isPointInRoundRectangle, setPathStrokeLinecap, getCrossingPointsBetweenEllipseAndSegment, drawLine, Path, RgbaToHEX, SELECTION_RECTANGLE_CLASS_NAME, getHitElementByPoint,
|
|
1
|
+
import { ACTIVE_STROKE_WIDTH, DEFAULT_COLOR, ThemeColorMode, RectangleClient, getSelectedElements, idCreator, catmullRomFitting, PlaitBoard, createG, drawLinearPath, setStrokeLinecap, distanceBetweenPointAndSegments, HIT_DISTANCE_BUFFER, isPointInPolygon, rotatePointsByElement, isPolylineHitRectangle, rotateAntiPointsByElement, distanceBetweenPointAndPoint, Transforms, clearSelectedElement, addSelectedElement, BoardTransforms, PlaitPointerType, depthFirstRecursion, getIsRecursionFunc, SNAPPING_STROKE_WIDTH, SELECTION_BORDER_COLOR, SELECTION_FILL_COLOR, drawCircle, createDebugGenerator, Point, arrowPoints, createPath, rotate, findElements, createMask, createRect, PlaitElement, getElementById, PlaitNode, hasValidAngle, toViewBoxPoint, toHostPoint, Direction, rotatePoints, getRectangleByElements, getSelectionAngle, rotatedDataPoints, isAxisChangedByAngle, isSelectionMoving, drawRectangle, getRectangleByAngle, getSnapRectangles, getTripleAxis, getMinPointDelta, SNAP_TOLERANCE, drawPointSnapLines, drawSolidLines, getNearestPointBetweenPointAndSegments, isPointInEllipse, getNearestPointBetweenPointAndEllipse, getEllipseTangentSlope, getVectorFromPointAndSlope, drawRoundRectangle, isPointInRoundRectangle, setPathStrokeLinecap, getCrossingPointsBetweenEllipseAndSegment, drawLine, Path, RgbaToHEX, SELECTION_RECTANGLE_CLASS_NAME, getHitElementByPoint, WritableClipboardOperationType, createClipboardContext, WritableClipboardType, addClipboardContext, setAngleForG, CursorClass, temporaryDisableSelection, PRESS_AND_MOVE_BUFFER, isMainPointer, throttleRAF, getAngleBetweenPoints, normalizeAngle, degreesToRadians, rotateElements, MERGING, ROTATE_HANDLE_CLASS_NAME, isSelectedElement, isDragging } from '@plait/core';
|
|
2
2
|
import { DEFAULT_FILL, Alignment, WithTextPluginKey, ELEMENT_TO_TEXT_MANAGES, TextManage, getMemorizedLatest, memorizeLatest, getPointOnPolyline, buildText, Generator, sortElementsByArea, isFilled, getTextEditorsByElement, removeDuplicatePoints, generateElbowLineRoute, simplifyOrthogonalPoints, getExtendPoint, getUnitVectorByPointAndPoint, getPointByVectorComponent, RESIZE_HANDLE_DIAMETER, measureElement, DEFAULT_FONT_FAMILY, getFirstTextManage, ActiveGenerator, isSourceAndTargetIntersect, getPoints, DEFAULT_ROUTE_MARGIN, normalizeShapePoints, getFirstTextEditor, resetPointsAfterResize, getDirectionByVector, getRectangleResizeHandleRefs, getRotatedResizeCursorClassByAngle, ROTATE_HANDLE_DISTANCE_TO_ELEMENT, ROTATE_HANDLE_SIZE, isCornerHandle, getIndexByResizeHandle, withResize, drawHandle, getSymmetricHandleIndex, getResizeHandlePointByIndex, getDirectionFactorByDirectionComponent, getCrossingPointsBetweenPointAndSegment, isPointOnSegment, getDirectionByPointOfRectangle, getDirectionFactor, rotateVector, getOppositeDirection, rotateVectorAnti90, getSourceAndTargetOuterRectangle, getNextPoint, PRIMARY_COLOR, CommonElementFlavour, canResize, drawPrimaryHandle, drawFillPrimaryHandle, isVirtualKey, isDelete, isSpaceHotkey, isDndMode, isDrawingMode, getElementsText, acceptImageTypes, getElementOfFocusedImage, buildImage, isResizingByCondition, getRatioByPoint, getTextManages, ImageGenerator, ResizeHandle, addRotating, removeRotating, drawRotateHandle } from '@plait/common';
|
|
3
3
|
import { pointsOnBezierCurves } from 'points-on-curve';
|
|
4
4
|
import { TEXT_DEFAULT_HEIGHT, DEFAULT_FONT_SIZE, AlignEditor } from '@plait/text-plugins';
|
|
@@ -2992,10 +2992,7 @@ const setTableFill = (board, element, fill, path) => {
|
|
|
2992
2992
|
if (selectedCells?.length) {
|
|
2993
2993
|
newCells = element.cells.map(cell => {
|
|
2994
2994
|
if (selectedCells.map(item => item.id).includes(cell.id)) {
|
|
2995
|
-
return
|
|
2996
|
-
...cell,
|
|
2997
|
-
fill
|
|
2998
|
-
};
|
|
2995
|
+
return getNewCell(cell, fill);
|
|
2999
2996
|
}
|
|
3000
2997
|
return cell;
|
|
3001
2998
|
});
|
|
@@ -3003,16 +3000,25 @@ const setTableFill = (board, element, fill, path) => {
|
|
|
3003
3000
|
else {
|
|
3004
3001
|
newCells = element.cells.map(cell => {
|
|
3005
3002
|
if (cell.text && cell.textHeight) {
|
|
3006
|
-
return
|
|
3007
|
-
...cell,
|
|
3008
|
-
fill
|
|
3009
|
-
};
|
|
3003
|
+
return getNewCell(cell, fill);
|
|
3010
3004
|
}
|
|
3011
3005
|
return cell;
|
|
3012
3006
|
});
|
|
3013
3007
|
}
|
|
3014
3008
|
Transforms.setNode(board, { cells: newCells }, path);
|
|
3015
3009
|
};
|
|
3010
|
+
const getNewCell = (cell, fill) => {
|
|
3011
|
+
const newCell = {
|
|
3012
|
+
...cell
|
|
3013
|
+
};
|
|
3014
|
+
if (fill) {
|
|
3015
|
+
newCell.fill = fill;
|
|
3016
|
+
}
|
|
3017
|
+
else {
|
|
3018
|
+
delete newCell.fill;
|
|
3019
|
+
}
|
|
3020
|
+
return newCell;
|
|
3021
|
+
};
|
|
3016
3022
|
|
|
3017
3023
|
const setVectorLineShape = (board, newProperties) => {
|
|
3018
3024
|
const elements = getSelectedVectorLineElements(board);
|
|
@@ -7201,7 +7207,6 @@ const withGeometryCreateByDrag = (board) => {
|
|
|
7201
7207
|
temporaryElement = null;
|
|
7202
7208
|
geometryShapeG?.remove();
|
|
7203
7209
|
geometryShapeG = null;
|
|
7204
|
-
preventTouchMove(board, event, false);
|
|
7205
7210
|
globalPointerUp(event);
|
|
7206
7211
|
};
|
|
7207
7212
|
return board;
|
|
@@ -7226,7 +7231,6 @@ const withGeometryCreateByDrawing = (board) => {
|
|
|
7226
7231
|
const point = toViewBoxPoint(board, toHostPoint(board, event.x, event.y));
|
|
7227
7232
|
start = point;
|
|
7228
7233
|
const pointer = PlaitBoard.getPointer(board);
|
|
7229
|
-
preventTouchMove(board, event, true);
|
|
7230
7234
|
if (pointer === BasicShapes.text) {
|
|
7231
7235
|
const memorizedLatest = getMemorizedLatestByPointer(pointer);
|
|
7232
7236
|
const property = getTextShapeProperty(board, DefaultTextProperty.text, memorizedLatest.textProperties['font-size']);
|
|
@@ -7285,7 +7289,6 @@ const withGeometryCreateByDrawing = (board) => {
|
|
|
7285
7289
|
geometryShapeG = null;
|
|
7286
7290
|
start = null;
|
|
7287
7291
|
temporaryElement = null;
|
|
7288
|
-
preventTouchMove(board, event, false);
|
|
7289
7292
|
return;
|
|
7290
7293
|
}
|
|
7291
7294
|
pointerUp(event);
|
|
@@ -7465,7 +7468,6 @@ const withArrowLineCreateByDraw = (board) => {
|
|
|
7465
7468
|
if (hitElement) {
|
|
7466
7469
|
sourceElement = hitElement;
|
|
7467
7470
|
}
|
|
7468
|
-
preventTouchMove(board, event, true);
|
|
7469
7471
|
}
|
|
7470
7472
|
pointerDown(event);
|
|
7471
7473
|
};
|
|
@@ -7491,7 +7493,6 @@ const withArrowLineCreateByDraw = (board) => {
|
|
|
7491
7493
|
sourceElement = null;
|
|
7492
7494
|
start = null;
|
|
7493
7495
|
temporaryElement = null;
|
|
7494
|
-
preventTouchMove(board, event, false);
|
|
7495
7496
|
globalPointerUp(event);
|
|
7496
7497
|
};
|
|
7497
7498
|
return board;
|
|
@@ -8091,7 +8092,6 @@ const withDrawRotate = (board) => {
|
|
|
8091
8092
|
removeRotating(board);
|
|
8092
8093
|
rotateRef = null;
|
|
8093
8094
|
MERGING.set(board, false);
|
|
8094
|
-
preventTouchMove(board, event, false);
|
|
8095
8095
|
};
|
|
8096
8096
|
board.afterChange = () => {
|
|
8097
8097
|
afterChange();
|
|
@@ -8542,7 +8542,6 @@ const withSwimlaneCreateByDrag = (board) => {
|
|
|
8542
8542
|
temporaryElement = null;
|
|
8543
8543
|
swimlaneG?.remove();
|
|
8544
8544
|
swimlaneG = null;
|
|
8545
|
-
preventTouchMove(board, event, false);
|
|
8546
8545
|
globalPointerUp(event);
|
|
8547
8546
|
};
|
|
8548
8547
|
return board;
|
|
@@ -8614,7 +8613,6 @@ const withSwimlaneCreateByDrawing = (board) => {
|
|
|
8614
8613
|
swimlaneG = null;
|
|
8615
8614
|
start = null;
|
|
8616
8615
|
temporaryElement = null;
|
|
8617
|
-
preventTouchMove(board, event, false);
|
|
8618
8616
|
return;
|
|
8619
8617
|
}
|
|
8620
8618
|
pointerUp(event);
|
|
@@ -8694,7 +8692,6 @@ const withVectorPenCreateByDraw = (board) => {
|
|
|
8694
8692
|
vectorLineComplete();
|
|
8695
8693
|
}
|
|
8696
8694
|
}
|
|
8697
|
-
preventTouchMove(board, event, true);
|
|
8698
8695
|
}
|
|
8699
8696
|
}
|
|
8700
8697
|
pointerDown(event);
|