@plait/mind 0.34.0 → 0.36.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/generators/node-active.generator.mjs +4 -4
- package/esm2022/mind-node.component.mjs +13 -6
- package/esm2022/plugins/with-abstract-resize.mjs +10 -10
- package/esm2022/plugins/with-mind-create.mjs +2 -2
- package/esm2022/plugins/with-node-resize.mjs +9 -5
- package/fesm2022/plait-mind.mjs +33 -22
- package/fesm2022/plait-mind.mjs.map +1 -1
- package/package.json +1 -1
- package/utils/position/image.d.ts +1 -1
- package/utils/space/node-space.d.ts +1 -1
package/fesm2022/plait-mind.mjs
CHANGED
|
@@ -2780,11 +2780,11 @@ class NodeActiveGenerator extends Generator {
|
|
|
2780
2780
|
return activeG;
|
|
2781
2781
|
}
|
|
2782
2782
|
updateAbstractOutline(element, activeHandlePosition, resizingLocation) {
|
|
2783
|
+
const abstractOutlineG = drawAbstractIncludedOutline(this.board, PlaitBoard.getRoughSVG(this.board), element, activeHandlePosition, resizingLocation);
|
|
2783
2784
|
if (this.abstractOutlineG) {
|
|
2784
|
-
this.abstractOutlineG.
|
|
2785
|
+
this.abstractOutlineG.replaceWith(abstractOutlineG);
|
|
2786
|
+
this.abstractOutlineG = abstractOutlineG;
|
|
2785
2787
|
}
|
|
2786
|
-
this.abstractOutlineG = drawAbstractIncludedOutline(this.board, PlaitBoard.getRoughSVG(this.board), element, activeHandlePosition, resizingLocation);
|
|
2787
|
-
this.g.append(this.abstractOutlineG);
|
|
2788
2788
|
}
|
|
2789
2789
|
}
|
|
2790
2790
|
|
|
@@ -2962,7 +2962,10 @@ class MindNodeComponent extends CommonPluginElement {
|
|
|
2962
2962
|
this.nodeShapeGenerator.processDrawing(this.element, this.g, { node: this.node });
|
|
2963
2963
|
this.drawLink();
|
|
2964
2964
|
this.drawTopic();
|
|
2965
|
-
this.activeGenerator.processDrawing(this.element, this.
|
|
2965
|
+
this.activeGenerator.processDrawing(this.element, PlaitBoard.getElementActiveHost(this.board), {
|
|
2966
|
+
selected: this.selected,
|
|
2967
|
+
isEditing: this.textManage.isEditing
|
|
2968
|
+
});
|
|
2966
2969
|
this.drawEmojis();
|
|
2967
2970
|
this.drawExtend();
|
|
2968
2971
|
this.imageGenerator.processDrawing(this.element, this.g, this.viewContainerRef);
|
|
@@ -2976,7 +2979,7 @@ class MindNodeComponent extends CommonPluginElement {
|
|
|
2976
2979
|
this.node = newNode;
|
|
2977
2980
|
const isChangeTheme = this.board.operations.find(op => op.type === 'set_theme');
|
|
2978
2981
|
if (!isEqualNode || value.element !== previous.element || isChangeTheme) {
|
|
2979
|
-
this.activeGenerator.processDrawing(this.element, this.
|
|
2982
|
+
this.activeGenerator.processDrawing(this.element, PlaitBoard.getElementActiveHost(this.board), { selected: this.selected, isEditing: this.textManage.isEditing });
|
|
2980
2983
|
this.nodeShapeGenerator.processDrawing(this.element, this.g, { node: this.node });
|
|
2981
2984
|
// this.nodeShapeGenerator.
|
|
2982
2985
|
this.drawLink();
|
|
@@ -2997,7 +3000,10 @@ class MindNodeComponent extends CommonPluginElement {
|
|
|
2997
3000
|
const hasSameSelected = value.selected === previous.selected;
|
|
2998
3001
|
const hasSameParent = value.parent === previous.parent;
|
|
2999
3002
|
if (!hasSameSelected) {
|
|
3000
|
-
this.activeGenerator.processDrawing(this.element, this.
|
|
3003
|
+
this.activeGenerator.processDrawing(this.element, PlaitBoard.getElementActiveHost(this.board), {
|
|
3004
|
+
selected: this.selected,
|
|
3005
|
+
isEditing: this.textManage.isEditing
|
|
3006
|
+
});
|
|
3001
3007
|
}
|
|
3002
3008
|
if (!hasSameParent) {
|
|
3003
3009
|
this.drawLink();
|
|
@@ -3052,10 +3058,10 @@ class MindNodeComponent extends CommonPluginElement {
|
|
|
3052
3058
|
this.textManage.updateRectangle();
|
|
3053
3059
|
}
|
|
3054
3060
|
editTopic() {
|
|
3055
|
-
this.activeGenerator.processDrawing(this.element, this.
|
|
3061
|
+
this.activeGenerator.processDrawing(this.element, PlaitBoard.getElementActiveHost(this.board), { selected: this.selected, isEditing: true });
|
|
3056
3062
|
this.textManage.edit((origin) => {
|
|
3057
3063
|
if (origin === ExitOrigin.default) {
|
|
3058
|
-
this.activeGenerator.processDrawing(this.element, this.
|
|
3064
|
+
this.activeGenerator.processDrawing(this.element, PlaitBoard.getElementActiveHost(this.board), { selected: this.selected, isEditing: false });
|
|
3059
3065
|
}
|
|
3060
3066
|
});
|
|
3061
3067
|
}
|
|
@@ -3064,6 +3070,7 @@ class MindNodeComponent extends CommonPluginElement {
|
|
|
3064
3070
|
this.textManage.destroy();
|
|
3065
3071
|
this.nodeEmojisGenerator.destroy();
|
|
3066
3072
|
this.imageGenerator.destroy();
|
|
3073
|
+
this.activeGenerator.destroy();
|
|
3067
3074
|
this.destroy$.next();
|
|
3068
3075
|
this.destroy$.complete();
|
|
3069
3076
|
if (ELEMENT_TO_NODE.get(this.element) === this.node) {
|
|
@@ -3315,15 +3322,15 @@ const withNodeDnd = (board) => {
|
|
|
3315
3322
|
|
|
3316
3323
|
const withAbstract = (board) => {
|
|
3317
3324
|
const newBoard = board;
|
|
3318
|
-
const {
|
|
3325
|
+
const { pointerDown, pointerMove, pointerUp } = board;
|
|
3319
3326
|
let activeAbstractElement;
|
|
3320
3327
|
let abstractHandlePosition;
|
|
3321
3328
|
let touchedAbstract;
|
|
3322
3329
|
let startPoint;
|
|
3323
3330
|
let newProperty;
|
|
3324
|
-
board.
|
|
3325
|
-
if (!isMainPointer(event)) {
|
|
3326
|
-
|
|
3331
|
+
board.pointerDown = (event) => {
|
|
3332
|
+
if (!isMainPointer(event) || PlaitBoard.isReadonly(board)) {
|
|
3333
|
+
pointerDown(event);
|
|
3327
3334
|
return;
|
|
3328
3335
|
}
|
|
3329
3336
|
const activeAbstractElements = getSelectedElements(board).filter(element => AbstractNode.isAbstract(element));
|
|
@@ -3340,9 +3347,9 @@ const withAbstract = (board) => {
|
|
|
3340
3347
|
startPoint = point;
|
|
3341
3348
|
return;
|
|
3342
3349
|
}
|
|
3343
|
-
|
|
3350
|
+
pointerDown(event);
|
|
3344
3351
|
};
|
|
3345
|
-
board.
|
|
3352
|
+
board.pointerMove = (event) => {
|
|
3346
3353
|
getSelectedElements(board);
|
|
3347
3354
|
const host = BOARD_TO_HOST.get(board);
|
|
3348
3355
|
const endPoint = transformPoint(board, toPoint(event.x, event.y, host));
|
|
@@ -3394,9 +3401,9 @@ const withAbstract = (board) => {
|
|
|
3394
3401
|
}
|
|
3395
3402
|
abstractComponent.activeGenerator.updateAbstractOutline(activeAbstractElement, abstractHandlePosition, location);
|
|
3396
3403
|
}
|
|
3397
|
-
|
|
3404
|
+
pointerMove(event);
|
|
3398
3405
|
};
|
|
3399
|
-
board.
|
|
3406
|
+
board.pointerUp = (event) => {
|
|
3400
3407
|
startPoint = undefined;
|
|
3401
3408
|
abstractHandlePosition = undefined;
|
|
3402
3409
|
if (activeAbstractElement) {
|
|
@@ -3413,7 +3420,7 @@ const withAbstract = (board) => {
|
|
|
3413
3420
|
}
|
|
3414
3421
|
activeAbstractElement = undefined;
|
|
3415
3422
|
}
|
|
3416
|
-
|
|
3423
|
+
pointerUp(event);
|
|
3417
3424
|
};
|
|
3418
3425
|
return board;
|
|
3419
3426
|
};
|
|
@@ -3436,7 +3443,7 @@ const withCreateMind = (board) => {
|
|
|
3436
3443
|
newBoard.mousedown = (event) => {
|
|
3437
3444
|
const isMindPointer = PlaitBoard.isPointer(board, MindPointerType.mind);
|
|
3438
3445
|
let movingPoint = PlaitBoard.getMovingPointInBoard(board);
|
|
3439
|
-
if (movingPoint && isDrawingMode(board) && isMindPointer) {
|
|
3446
|
+
if (!PlaitBoard.isReadonly(board) && movingPoint && isDrawingMode(board) && isMindPointer) {
|
|
3440
3447
|
movingPoint = transformPoint(board, toPoint(movingPoint[0], movingPoint[1], PlaitBoard.getHost(board)));
|
|
3441
3448
|
const emptyMind = createEmptyMind(newBoard, movingPoint);
|
|
3442
3449
|
Transforms.insertNode(board, emptyMind, [board.children.length]);
|
|
@@ -3752,10 +3759,14 @@ const withNodeResize = (board) => {
|
|
|
3752
3759
|
let targetElementRef = null;
|
|
3753
3760
|
let startPoint = null;
|
|
3754
3761
|
board.pointerDown = (event) => {
|
|
3762
|
+
if (PlaitBoard.isReadonly(board)) {
|
|
3763
|
+
pointerDown(event);
|
|
3764
|
+
return;
|
|
3765
|
+
}
|
|
3755
3766
|
const point = transformPoint(board, toPoint(event.x, event.y, PlaitBoard.getHost(board)));
|
|
3756
3767
|
const newTargetElement = getSelectedTarget(board, point);
|
|
3757
3768
|
if (newTargetElement) {
|
|
3758
|
-
PlaitBoard.getBoardContainer(board).classList.add(ResizeCursorClass['ew
|
|
3769
|
+
PlaitBoard.getBoardContainer(board).classList.add(ResizeCursorClass['ew']);
|
|
3759
3770
|
targetElement = newTargetElement;
|
|
3760
3771
|
startPoint = [event.x, event.y];
|
|
3761
3772
|
preventTouchMove(board, event, true);
|
|
@@ -3813,10 +3824,10 @@ const withNodeResize = (board) => {
|
|
|
3813
3824
|
const point = transformPoint(board, toPoint(event.x, event.y, PlaitBoard.getHost(board)));
|
|
3814
3825
|
const newTargetElement = getSelectedTarget(board, point);
|
|
3815
3826
|
if (newTargetElement) {
|
|
3816
|
-
PlaitBoard.getBoardContainer(board).classList.add(`mind-${ResizeCursorClass['ew
|
|
3827
|
+
PlaitBoard.getBoardContainer(board).classList.add(`mind-${ResizeCursorClass['ew']}`);
|
|
3817
3828
|
}
|
|
3818
3829
|
else {
|
|
3819
|
-
PlaitBoard.getBoardContainer(board).classList.remove(`mind-${ResizeCursorClass['ew
|
|
3830
|
+
PlaitBoard.getBoardContainer(board).classList.remove(`mind-${ResizeCursorClass['ew']}`);
|
|
3820
3831
|
}
|
|
3821
3832
|
}
|
|
3822
3833
|
}
|
|
@@ -3847,7 +3858,7 @@ const addResizing = (board, element) => {
|
|
|
3847
3858
|
};
|
|
3848
3859
|
const removeResizing = (board, element) => {
|
|
3849
3860
|
PlaitBoard.getBoardContainer(board).classList.remove('mind-node-resizing');
|
|
3850
|
-
PlaitBoard.getBoardContainer(board).classList.remove(ResizeCursorClass['ew
|
|
3861
|
+
PlaitBoard.getBoardContainer(board).classList.remove(ResizeCursorClass['ew']);
|
|
3851
3862
|
const component = PlaitElement.getComponent(element);
|
|
3852
3863
|
if (component && component.g) {
|
|
3853
3864
|
component.g.classList.remove('resizing');
|