@plait/mind 0.93.0 → 0.93.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.
package/fesm2022/plait-mind.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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, createText, isSelectionMoving, isDragging, isMovingElements, NODE_TO_INDEX, PlaitPointerType, isMainPointer, toViewBoxPoint, toHostPoint, getHitElementByPoint, distanceBetweenPointAndPoint, CoreTransforms, toActivePointFromViewBoxPoint, BoardTransforms, throttleRAF, getElementById, isTouchDevice, isSelectedElement, isContextmenu, temporaryDisableSelection, hotkeys, createClipboardContext, WritableClipboardType, Point, ResizeCursorClass, WritableClipboardOperationType, addOrCreateClipboardContext } from '@plait/core';
|
|
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, createText, isSelectionMoving, isDragging, isMovingElements, NODE_TO_INDEX, PlaitPointerType, isMainPointer, toViewBoxPoint, toHostPoint, getHitElementByPoint, distanceBetweenPointAndPoint, CoreTransforms, toActivePointFromViewBoxPoint, BoardTransforms, throttleRAF, createDebugGenerator, getElementById, isTouchDevice, isSelectedElement, 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
3
|
import { StrokeStyle, getFirstTextManage, buildText, getElementSize, DEFAULT_FONT_FAMILY, RESIZE_HANDLE_DIAMETER, getRectangleResizeHandleRefs, addElementOfFocusedImage, ImageGenerator, removeElementOfFocusedImage, getStrokeLineDash, getXDistanceBetweenPoint, moveXOfPoint, moveYOfPoint, Generator, PropertyTransforms, TRANSPARENT, measureElement, 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 { DEFAULT_FONT_SIZE, PlaitMarkEditor, MarkTypes, FontSizes } from '@plait/text-plugins';
|
|
@@ -2808,7 +2808,7 @@ const getNodeMoreKeyPosition = (board, element) => {
|
|
|
2808
2808
|
const endPoint = moveXOfPoint(startPoint, NODE_MORE_LINE_DISTANCE, layoutDirection);
|
|
2809
2809
|
const hasCollapsedIcon = element.children?.length > 0 && !isMind && !element.isCollapsed;
|
|
2810
2810
|
const hasExpandedIcon = element.children?.length > 0 && !isMind && element.isCollapsed;
|
|
2811
|
-
const hasAddIcon = !hasExpandedIcon;
|
|
2811
|
+
const hasAddIcon = !hasExpandedIcon && !PlaitBoard.isReadonly(board);
|
|
2812
2812
|
const firstIconCenter = moveXOfPoint(endPoint, NODE_MORE_ICON_DIAMETER / 2, layoutDirection);
|
|
2813
2813
|
const collapsedIconCenter = hasCollapsedIcon ? firstIconCenter : null;
|
|
2814
2814
|
const expandedIconCenter = hasExpandedIcon ? firstIconCenter : null;
|
|
@@ -2833,6 +2833,13 @@ const getNodeMoreKeyPosition = (board, element) => {
|
|
|
2833
2833
|
moveYOfPoint(expandedIconEndPoint, NODE_MORE_ICON_DIAMETER / 2, layoutDirection)
|
|
2834
2834
|
]);
|
|
2835
2835
|
}
|
|
2836
|
+
else if (hasCollapsedIcon) {
|
|
2837
|
+
const collapsedIconEndPoint = moveXOfPoint(collapsedIconCenter, NODE_MORE_ICON_DIAMETER / 2, layoutDirection);
|
|
2838
|
+
awarenessRectangle = RectangleClient.getRectangleByPoints([
|
|
2839
|
+
moveYOfPoint(startPoint, -NODE_MORE_ICON_DIAMETER / 2, layoutDirection),
|
|
2840
|
+
moveYOfPoint(collapsedIconEndPoint, NODE_MORE_ICON_DIAMETER / 2, layoutDirection)
|
|
2841
|
+
]);
|
|
2842
|
+
}
|
|
2836
2843
|
let standardRef = null;
|
|
2837
2844
|
if (hasLeftAddIcon) {
|
|
2838
2845
|
const leftStartPoint = getNodeMoreStartPoint(board, element, layoutDirection, true);
|
|
@@ -3502,6 +3509,7 @@ const withMindHotkey = (baseBoard) => {
|
|
|
3502
3509
|
return board;
|
|
3503
3510
|
};
|
|
3504
3511
|
|
|
3512
|
+
const debugGenerator = createDebugGenerator('debug:plait:node-more');
|
|
3505
3513
|
const isSameNodeMoreRef = (ref1, ref2) => {
|
|
3506
3514
|
if (!ref1 || !ref2) {
|
|
3507
3515
|
return false;
|
|
@@ -3680,6 +3688,17 @@ const getNodeMoreRef = (board, x, y) => {
|
|
|
3680
3688
|
const isHitStandardLeftAddIcon = hasLeftAddIcon &&
|
|
3681
3689
|
standardRef &&
|
|
3682
3690
|
RectangleClient.isHit(RectangleClient.getRectangleByPoints([point, point]), RectangleClient.getRectangleByCenterPoint(standardRef.addCenter, NODE_MORE_ICON_DIAMETER, NODE_MORE_ICON_DIAMETER));
|
|
3691
|
+
if (debugGenerator.isDebug()) {
|
|
3692
|
+
debugGenerator.clear();
|
|
3693
|
+
if (awarenessRectangle) {
|
|
3694
|
+
debugGenerator.drawRectangle(board, awarenessRectangle);
|
|
3695
|
+
}
|
|
3696
|
+
const data = element.data.topic;
|
|
3697
|
+
const string = Node$1.string(data);
|
|
3698
|
+
if (string === 'xxxx') {
|
|
3699
|
+
console.log('xxxx');
|
|
3700
|
+
}
|
|
3701
|
+
}
|
|
3683
3702
|
if (isHitElement || isHitAwarenessRectangleInternal || isHitStandardLeftAwarenessRectangleInternal) {
|
|
3684
3703
|
isHit = isHitElement;
|
|
3685
3704
|
target = element;
|