@plait/mind 0.82.0 → 0.83.1

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.
@@ -2,7 +2,7 @@ export declare const WithMindPluginKey = "plait-mind-plugin-key";
2
2
  export declare const BASE = 4;
3
3
  export declare const PRIMARY_COLOR = "#6698FF";
4
4
  export declare const GRAY_COLOR = "#AAAAAA";
5
- export declare const STROKE_WIDTH = 3;
5
+ export declare const STROKE_WIDTH = 2;
6
6
  export declare const RESIZE_HANDLE_BUFFER_DISTANCE = 8;
7
7
  export declare const NODE_MORE_LINE_DISTANCE = 10;
8
8
  export declare const NODE_MORE_STROKE_WIDTH = 2;
@@ -1,6 +1,6 @@
1
1
  import { DEFAULT_COLOR, DefaultThemeColor, ColorfulThemeColor, SoftThemeColor, RetroThemeColor, DarkThemeColor, StarryThemeColor, rgbaToHEX, PlaitElement, PlaitNode, Path, isNullOrUndefined, PlaitBoard, getSelectedElements, getI18nValue, idCreator, Transforms, clearSelectedElement, addSelectedElement, distanceBetweenPointAndRectangle, RectangleClient, setDragging, depthFirstRecursion, getIsRecursionFunc, drawRoundRectangle, drawLinearPath, drawBezierPath, setStrokeLinecap, createG, createForeignObject, updateForeignObject, getRectangleByElements, toActiveRectangleFromViewBoxRectangle, ACTIVE_STROKE_WIDTH, SELECTION_RECTANGLE_CLASS_NAME, NODE_TO_PARENT, removeSelectedElement, PlaitHistoryBoard, isSelectedElement, createText, isSelectionMoving, isDragging, isMovingElements, NODE_TO_INDEX, PlaitPointerType, isMainPointer, toViewBoxPoint, toHostPoint, getHitElementByPoint, distanceBetweenPointAndPoint, CoreTransforms, toActivePointFromViewBoxPoint, BoardTransforms, throttleRAF, isContextmenu, temporaryDisableSelection, hotkeys, createClipboardContext, WritableClipboardType, Point, ResizeCursorClass, WritableClipboardOperationType, addOrCreateClipboardContext } from '@plait/core';
2
2
  import { MindLayoutType, AbstractNode, isIndentedLayout, isHorizontalLogicLayout, ConnectingPosition, isHorizontalLayout, getNonAbstractChildren, isStandardLayout, isLeftLayout, isRightLayout, isVerticalLogicLayout, isTopLayout, isBottomLayout, getCorrectStartEnd, getAbstractLayout, GlobalLayout } from '@plait/layouts';
3
- import { StrokeStyle, getFirstTextManage, DEFAULT_FONT_FAMILY, measureElement, buildText, getFirstTextEditor, RESIZE_HANDLE_DIAMETER, getRectangleResizeHandleRefs, addElementOfFocusedImage, ImageGenerator, removeElementOfFocusedImage, getStrokeLineDash, Generator, PropertyTransforms, TRANSPARENT, isResizing, CommonElementFlavour, WithTextPluginKey, TextManage, isDrawingMode, isDndMode, setCreationMode, BoardCreationMode, isExpandHotkey, isTabHotkey, isEnterHotkey, isVirtualKey, isDelete, isSpaceHotkey, getElementOfFocusedImage, acceptImageTypes, buildImage, withResize, getElementsText } from '@plait/common';
3
+ import { StrokeStyle, getFirstTextManage, DEFAULT_FONT_FAMILY, measureElement, buildText, getFirstTextEditor, RESIZE_HANDLE_DIAMETER, getRectangleResizeHandleRefs, addElementOfFocusedImage, ImageGenerator, removeElementOfFocusedImage, getStrokeLineDash, getXDistanceBetweenPoint, moveXOfPoint, moveYOfPoint, Generator, PropertyTransforms, TRANSPARENT, isResizing, CommonElementFlavour, WithTextPluginKey, TextManage, isDrawingMode, isDndMode, setCreationMode, BoardCreationMode, isExpandHotkey, isTabHotkey, isEnterHotkey, isVirtualKey, isDelete, isSpaceHotkey, getElementOfFocusedImage, acceptImageTypes, buildImage, withResize, getElementsText } from '@plait/common';
4
4
  import { TEXT_DEFAULT_HEIGHT, PlaitMarkEditor, MarkTypes, DEFAULT_FONT_SIZE, FontSizes } from '@plait/text-plugins';
5
5
  import { Node as Node$1, Path as Path$1 } from 'slate';
6
6
  import { pointsOnBezierCurves } from 'points-on-curve';
@@ -177,7 +177,7 @@ const WithMindPluginKey = 'plait-mind-plugin-key';
177
177
  const BASE = 4;
178
178
  const PRIMARY_COLOR = '#6698FF';
179
179
  const GRAY_COLOR = '#AAAAAA';
180
- const STROKE_WIDTH = 3;
180
+ const STROKE_WIDTH = 2;
181
181
  const RESIZE_HANDLE_BUFFER_DISTANCE = 8;
182
182
  const NODE_MORE_LINE_DISTANCE = 10;
183
183
  const NODE_MORE_STROKE_WIDTH = 2;
@@ -224,11 +224,11 @@ const DefaultAbstractNodeStyle = {
224
224
  };
225
225
  const DefaultNodeStyle = {
226
226
  branch: {
227
- width: 3
227
+ width: 2
228
228
  },
229
229
  shape: {
230
230
  rectangleRadius: 4,
231
- strokeWidth: 3,
231
+ strokeWidth: 2,
232
232
  fill: 'none'
233
233
  }
234
234
  };
@@ -1395,14 +1395,6 @@ const getPointByPlacement = (client, placement) => {
1395
1395
  }
1396
1396
  return [x, y];
1397
1397
  };
1398
- const getXDistanceBetweenPoint = (point1, point2, isHorizontalLayout) => {
1399
- if (isHorizontalLayout) {
1400
- return Math.abs(point1[0] - point2[0]);
1401
- }
1402
- else {
1403
- return Math.abs(point1[1] - point2[1]);
1404
- }
1405
- };
1406
1398
  const getYDistanceBetweenPoint = (point1, point2, isHorizontalLayout) => {
1407
1399
  getXDistanceBetweenPoint(point1, point2, !isHorizontalLayout);
1408
1400
  };
@@ -1424,37 +1416,6 @@ const getLayoutDirection = (node, isHorizontal) => {
1424
1416
  }
1425
1417
  }
1426
1418
  };
1427
- // Based on right
1428
- // Right -> Left:
1429
- // 1. End point -> starting point/start point -> end point
1430
- // 2. Add -> Subtract
1431
- // Horizontal -> Vertical:
1432
- // 1. Starting point/end point -> vertical axis
1433
- // 2. Addition and subtraction -> vertical axis
1434
- // Bottom -> Top:
1435
- // 1. End point -> starting point/end point -> starting point
1436
- // 2. Add -> Subtract
1437
- const moveXOfPoint = (point, distance, direction = LayoutDirection.right) => {
1438
- if (direction === LayoutDirection.left) {
1439
- return [point[0] - distance, point[1]];
1440
- }
1441
- if (direction === LayoutDirection.bottom) {
1442
- return [point[0], point[1] + distance];
1443
- }
1444
- if (direction === LayoutDirection.top) {
1445
- return [point[0], point[1] - distance];
1446
- }
1447
- return [point[0] + distance, point[1]];
1448
- };
1449
- const moveYOfPoint = (point, distance, direction = LayoutDirection.right) => {
1450
- if (direction === LayoutDirection.bottom) {
1451
- return [point[0] + distance, point[1]];
1452
- }
1453
- if (direction === LayoutDirection.top) {
1454
- return [point[0] + distance, point[1]];
1455
- }
1456
- return [point[0], point[1] + distance];
1457
- };
1458
1419
  const transformPlacement = (placement, direction) => {
1459
1420
  // to left
1460
1421
  if (direction === LayoutDirection.left) {
@@ -1565,7 +1526,9 @@ function drawLogicLink(board, parent, node, isHorizontal, defaultStrokeColor = n
1565
1526
  let endPoint = getPointByPlacement(nodeClient, endPlacement);
1566
1527
  // ② Determine the convex straight line
1567
1528
  const straightLineDistance = 8;
1568
- const beginPoint2 = hasStraightLine ? moveXOfPoint(beginPoint, straightLineDistance, linkDirection) : beginPoint;
1529
+ const beginPoint2 = hasStraightLine
1530
+ ? moveXOfPoint(beginPoint, straightLineDistance, linkDirection)
1531
+ : beginPoint;
1569
1532
  let straightLine = hasStraightLine ? [beginPoint, beginPoint2, beginPoint2] : [];
1570
1533
  // ③ Determine the curve
1571
1534
  const beginBufferDistance = (parent.hGap + node.hGap) / 3;
@@ -2893,7 +2856,7 @@ class NodeMoreGenerator extends Generator {
2893
2856
  fontSize: Number(FontSizes.fontSize12),
2894
2857
  fontFamily: DEFAULT_FONT_FAMILY
2895
2858
  });
2896
- const badgeText = createText(center[0] - width / 2 + 0.5, y, stroke, `${text}`);
2859
+ const badgeText = createText(center[0] - width / 2, y, stroke, `${text}`);
2897
2860
  badgeText.setAttribute('style', `font-size: ${Number(FontSizes.fontSize12)}px;`);
2898
2861
  this.expandG.appendChild(moreLine);
2899
2862
  this.expandG.appendChild(badgeBackground);