@plait/mind 0.10.0 → 0.12.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.
@@ -735,10 +735,10 @@ const isDragging = (board) => {
735
735
  const setIsDragging = (board, state) => {
736
736
  IS_DRAGGING.set(board, state);
737
737
  if (state) {
738
- PlaitBoard.getBoardNativeElement(board).classList.add('mind-node-dragging');
738
+ PlaitBoard.getBoardContainer(board).classList.add('mind-node-dragging');
739
739
  }
740
740
  else {
741
- PlaitBoard.getBoardNativeElement(board).classList.remove('mind-node-dragging');
741
+ PlaitBoard.getBoardContainer(board).classList.remove('mind-node-dragging');
742
742
  }
743
743
  };
744
744
  const hasPreviousOrNextOfDropPath = (parent, dropTarget, dropPath) => {
@@ -2459,7 +2459,7 @@ function drawAbstractIncludedOutline(board, roughSVG, element, activeHandlePosit
2459
2459
  const endPoint2 = moveXOfPoint(endCenterPoint, ABSTRACT_HANDLE_LENGTH / 2, linkDirection);
2460
2460
  const startHandle = roughSVG.line(startPoint1[0], startPoint1[1], startPoint2[0], startPoint2[1], getHandleOption(activeHandlePosition === AbstractHandlePosition.start));
2461
2461
  const endHandle = roughSVG.line(endPoint1[0], endPoint1[1], endPoint2[0], endPoint2[1], getHandleOption(activeHandlePosition === AbstractHandlePosition.end));
2462
- changeBoardClass(board, activeHandlePosition, isHorizontal);
2462
+ handleBoardClass(board, activeHandlePosition, isHorizontal);
2463
2463
  startHandle.setAttribute('stroke-linecap', 'round');
2464
2464
  endHandle.setAttribute('stroke-linecap', 'round');
2465
2465
  abstractIncludedG.append(startHandle);
@@ -2480,18 +2480,18 @@ function getHandleOption(isHover) {
2480
2480
  fillStyle: 'solid'
2481
2481
  };
2482
2482
  }
2483
- function changeBoardClass(board, activeHandlePosition, isHorizontal) {
2483
+ function handleBoardClass(board, activeHandlePosition, isHorizontal) {
2484
2484
  if (activeHandlePosition) {
2485
2485
  if (isHorizontal) {
2486
- PlaitBoard.getBoardNativeElement(board).classList.add('abstract-resizing-horizontal');
2486
+ PlaitBoard.getBoardContainer(board).classList.add('abstract-resizing-horizontal');
2487
2487
  }
2488
2488
  else {
2489
- PlaitBoard.getBoardNativeElement(board).classList.add('abstract-resizing-vertical');
2489
+ PlaitBoard.getBoardContainer(board).classList.add('abstract-resizing-vertical');
2490
2490
  }
2491
2491
  }
2492
2492
  else {
2493
- PlaitBoard.getBoardNativeElement(board).classList.remove('abstract-resizing-horizontal');
2494
- PlaitBoard.getBoardNativeElement(board).classList.remove('abstract-resizing-vertical');
2493
+ PlaitBoard.getBoardContainer(board).classList.remove('abstract-resizing-horizontal');
2494
+ PlaitBoard.getBoardContainer(board).classList.remove('abstract-resizing-vertical');
2495
2495
  }
2496
2496
  }
2497
2497
 
@@ -2625,6 +2625,9 @@ class CollapseDrawer extends BaseDrawer {
2625
2625
  }
2626
2626
  }
2627
2627
 
2628
+ // 1. When the text at the end has an italic attribute, the text is partially covered
2629
+ // 2. There will be some differences in the width measured by different browsers
2630
+ const WIDTH_BUFFER = 4;
2628
2631
  class MindNodeComponent extends PlaitPluginElementComponent {
2629
2632
  constructor(viewContainerRef, cdr) {
2630
2633
  super(cdr);
@@ -2641,8 +2644,11 @@ class MindNodeComponent extends PlaitPluginElementComponent {
2641
2644
  this.nodeInsertDrawer = new NodeInsertDrawer(this.board);
2642
2645
  this.activeDrawer = new NodeActiveDrawer(this.board);
2643
2646
  this.collapseDrawer = new CollapseDrawer(this.board);
2647
+ const plugins = this.board.getMindOptions().textPlugins;
2644
2648
  this.textManage = new TextManage(this.board, this.viewContainerRef, () => {
2645
- return getTopicRectangleByNode(this.board, this.node);
2649
+ const rect = getTopicRectangleByNode(this.board, this.node);
2650
+ rect.width = rect.width + WIDTH_BUFFER;
2651
+ return rect;
2646
2652
  }, (point) => {
2647
2653
  return isHitMindElement(this.board, point, this.element);
2648
2654
  }, (textManageRef) => {
@@ -2654,7 +2660,7 @@ class MindNodeComponent extends PlaitPluginElementComponent {
2654
2660
  else {
2655
2661
  MindTransforms.setTopicSize(this.board, this.element, width, height);
2656
2662
  }
2657
- });
2663
+ }, plugins);
2658
2664
  }
2659
2665
  ngOnInit() {
2660
2666
  super.ngOnInit();
@@ -3473,7 +3479,7 @@ const withNodeHover = (board) => {
3473
3479
  else {
3474
3480
  return false;
3475
3481
  }
3476
- });
3482
+ }, true);
3477
3483
  if (hoveredMindElement && target && hoveredMindElement === target) {
3478
3484
  return;
3479
3485
  }