@8btc/whiteboard 0.0.9 → 0.0.11
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/dist/index.d.ts +3 -2
- package/dist/index.js +43 -38
- package/dist/index.umd.js +43 -38
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -60,8 +60,9 @@ export declare class CanvasApi extends CanvasCore {
|
|
|
60
60
|
* 删除指定的节点
|
|
61
61
|
* 如果删除的是 image 节点,会同步删除所有关联的 image-marker
|
|
62
62
|
* @param nodeIds - 要删除的节点 ID 数组
|
|
63
|
+
* @returns 被删除的节点数据数组
|
|
63
64
|
*/
|
|
64
|
-
deleteNodes(nodeIds: string[]):
|
|
65
|
+
deleteNodes(nodeIds: string[]): INode[];
|
|
65
66
|
/**
|
|
66
67
|
* 滚动到内容区域
|
|
67
68
|
* - 如果提供了 nodeIds,将指定的节点居中显示
|
|
@@ -386,7 +387,7 @@ declare type StateEvents = {
|
|
|
386
387
|
"transformer:positionChange": TransformerPosition | null;
|
|
387
388
|
"toolType:change": ICoreState["toolType"];
|
|
388
389
|
"nodes:created": ICoreState["nodes"];
|
|
389
|
-
"nodes:deleted":
|
|
390
|
+
"nodes:deleted": INode[];
|
|
390
391
|
};
|
|
391
392
|
|
|
392
393
|
export declare type ToolType = "select" | "hand" | "rectangle" | "image-marker";
|
package/dist/index.js
CHANGED
|
@@ -518,12 +518,14 @@ const IMAGE = {
|
|
|
518
518
|
MIN_SIZE: 10
|
|
519
519
|
};
|
|
520
520
|
class BaseCanvasNode {
|
|
521
|
-
constructor(core, node) {
|
|
521
|
+
constructor(core, node, isDraft = false) {
|
|
522
522
|
__publicField(this, "core");
|
|
523
523
|
__publicField(this, "node");
|
|
524
524
|
__publicField(this, "element");
|
|
525
|
+
__publicField(this, "isDraft");
|
|
525
526
|
this.core = core;
|
|
526
527
|
this.node = node;
|
|
528
|
+
this.isDraft = isDraft;
|
|
527
529
|
this.element = this.createElement();
|
|
528
530
|
}
|
|
529
531
|
/**
|
|
@@ -546,8 +548,8 @@ function getRectSize(rect) {
|
|
|
546
548
|
};
|
|
547
549
|
}
|
|
548
550
|
class RectNode extends BaseCanvasNode {
|
|
549
|
-
constructor(core, node) {
|
|
550
|
-
super(core, node);
|
|
551
|
+
constructor(core, node, isDraft = false) {
|
|
552
|
+
super(core, node, isDraft);
|
|
551
553
|
__privateAdd(this, _RectNode_instances);
|
|
552
554
|
__privateAdd(this, _toolTypeChangeHandler, (toolType) => {
|
|
553
555
|
const isSelect = toolType === "select";
|
|
@@ -672,8 +674,8 @@ setupEventHandlers_fn = function(rect) {
|
|
|
672
674
|
});
|
|
673
675
|
};
|
|
674
676
|
class ImageNode extends BaseCanvasNode {
|
|
675
|
-
constructor(core, node) {
|
|
676
|
-
super(core, node);
|
|
677
|
+
constructor(core, node, isDraft = false) {
|
|
678
|
+
super(core, node, isDraft);
|
|
677
679
|
__privateAdd(this, _ImageNode_instances);
|
|
678
680
|
__privateAdd(this, _toolTypeChangeHandler2, (toolType) => {
|
|
679
681
|
const isSelect = toolType === "select";
|
|
@@ -880,8 +882,8 @@ syncImageMarkersToState_fn = function() {
|
|
|
880
882
|
});
|
|
881
883
|
};
|
|
882
884
|
class ImageMarkerNode extends BaseCanvasNode {
|
|
883
|
-
constructor(core, node) {
|
|
884
|
-
super(core, node);
|
|
885
|
+
constructor(core, node, isDraft = false) {
|
|
886
|
+
super(core, node, isDraft);
|
|
885
887
|
__privateAdd(this, _ImageMarkerNode_instances);
|
|
886
888
|
__privateAdd(this, _rect);
|
|
887
889
|
__privateAdd(this, _markerGroup);
|
|
@@ -905,12 +907,11 @@ class ImageMarkerNode extends BaseCanvasNode {
|
|
|
905
907
|
);
|
|
906
908
|
const group = new Konva.Group({
|
|
907
909
|
id: this.node.id,
|
|
908
|
-
name: `static ${this.node.meta.parent}`,
|
|
910
|
+
name: `static ${this.node.meta.parent} imageMarker`,
|
|
909
911
|
x: this.node.props.x,
|
|
910
912
|
y: this.node.props.y,
|
|
911
913
|
width,
|
|
912
|
-
height
|
|
913
|
-
listening: false
|
|
914
|
+
height
|
|
914
915
|
});
|
|
915
916
|
const rect = new Konva.Rect({
|
|
916
917
|
name: "rect",
|
|
@@ -922,12 +923,14 @@ class ImageMarkerNode extends BaseCanvasNode {
|
|
|
922
923
|
strokeWidth: 2,
|
|
923
924
|
dash: [5, 5],
|
|
924
925
|
fill: "transparent",
|
|
925
|
-
cornerRadius: RECT.CORNER_RADIUS
|
|
926
|
+
cornerRadius: RECT.CORNER_RADIUS,
|
|
927
|
+
listening: false
|
|
926
928
|
});
|
|
927
929
|
const markerGroup = new Konva.Group({
|
|
928
930
|
name: "marker-group",
|
|
929
931
|
x: width,
|
|
930
|
-
y: height
|
|
932
|
+
y: height,
|
|
933
|
+
visible: this.isDraft ? false : true
|
|
931
934
|
});
|
|
932
935
|
const stageScale = this.core.getStageScale();
|
|
933
936
|
const radius = 16 / stageScale;
|
|
@@ -1014,7 +1017,7 @@ class ImageMarkerNode extends BaseCanvasNode {
|
|
|
1014
1017
|
* 更新焦点状态(hover 或 selected)
|
|
1015
1018
|
*/
|
|
1016
1019
|
setFocusState(isFocus) {
|
|
1017
|
-
const strokeWidth = isFocus ?
|
|
1020
|
+
const strokeWidth = isFocus ? 4 : 2;
|
|
1018
1021
|
const scale = isFocus ? 1.2 : 1;
|
|
1019
1022
|
__privateGet(this, _rect).strokeWidth(strokeWidth);
|
|
1020
1023
|
__privateGet(this, _circle).strokeWidth(strokeWidth);
|
|
@@ -1045,14 +1048,14 @@ setupEventHandlers_fn3 = function() {
|
|
|
1045
1048
|
this.core.selectNode(this.node.id);
|
|
1046
1049
|
});
|
|
1047
1050
|
};
|
|
1048
|
-
function createCanvasNodeByType(core, type, config) {
|
|
1051
|
+
function createCanvasNodeByType(core, type, config, isDraft = false) {
|
|
1049
1052
|
switch (type) {
|
|
1050
1053
|
case "rectangle":
|
|
1051
|
-
return new RectNode(core, config);
|
|
1054
|
+
return new RectNode(core, config, isDraft);
|
|
1052
1055
|
case "image":
|
|
1053
|
-
return new ImageNode(core, config);
|
|
1056
|
+
return new ImageNode(core, config, isDraft);
|
|
1054
1057
|
case "image-marker":
|
|
1055
|
-
return new ImageMarkerNode(core, config);
|
|
1058
|
+
return new ImageMarkerNode(core, config, isDraft);
|
|
1056
1059
|
default:
|
|
1057
1060
|
return null;
|
|
1058
1061
|
}
|
|
@@ -1283,7 +1286,7 @@ class CanvasCore extends CanvasState {
|
|
|
1283
1286
|
__privateGet(this, _canvasTransformer).emitPositionChange();
|
|
1284
1287
|
}
|
|
1285
1288
|
createNodes(nodes) {
|
|
1286
|
-
const canvasNodes = nodes.map((node) => createCanvasNodeByType(this, node.type, node)).filter((node) => node !== null);
|
|
1289
|
+
const canvasNodes = nodes.map((node) => createCanvasNodeByType(this, node.type, node, false)).filter((node) => node !== null);
|
|
1287
1290
|
canvasNodes.forEach((node) => {
|
|
1288
1291
|
__privateGet(this, _mainLayer).add(node.getElement());
|
|
1289
1292
|
});
|
|
@@ -1354,26 +1357,25 @@ class CanvasCore extends CanvasState {
|
|
|
1354
1357
|
* @internal 仅供内部使用
|
|
1355
1358
|
*/
|
|
1356
1359
|
findImageAtPosition(position) {
|
|
1357
|
-
const layer = __privateGet(this, _mainLayer)
|
|
1358
|
-
const
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
const originalListeningStates = imageShapes.map(
|
|
1362
|
-
(shape) => shape.listening()
|
|
1360
|
+
const layer = __privateGet(this, _mainLayer);
|
|
1361
|
+
const shapes = layer.getChildren();
|
|
1362
|
+
const filteredShapes = shapes.filter(
|
|
1363
|
+
(shape) => !shape.name().includes("imageMarker")
|
|
1363
1364
|
);
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
const
|
|
1368
|
-
|
|
1369
|
-
|
|
1365
|
+
const sortedShapes = filteredShapes.slice().sort((a, b) => b.zIndex() - a.zIndex());
|
|
1366
|
+
for (const shape of sortedShapes) {
|
|
1367
|
+
const x = shape.x();
|
|
1368
|
+
const y = shape.y();
|
|
1369
|
+
const width = shape.width();
|
|
1370
|
+
const height = shape.height();
|
|
1371
|
+
if (position.x >= x && position.x <= x + width && position.y >= y && position.y <= y + height) {
|
|
1372
|
+
if (shape.getClassName() === "Image") {
|
|
1373
|
+
return shape;
|
|
1374
|
+
}
|
|
1375
|
+
return null;
|
|
1370
1376
|
}
|
|
1371
|
-
return null;
|
|
1372
|
-
} finally {
|
|
1373
|
-
imageShapes.forEach((shape, index) => {
|
|
1374
|
-
shape.listening(originalListeningStates[index]);
|
|
1375
|
-
});
|
|
1376
1377
|
}
|
|
1378
|
+
return null;
|
|
1377
1379
|
}
|
|
1378
1380
|
/**
|
|
1379
1381
|
* @internal 仅供内部使用
|
|
@@ -1383,7 +1385,7 @@ class CanvasCore extends CanvasState {
|
|
|
1383
1385
|
__privateGet(this, _draftNode).destroy();
|
|
1384
1386
|
}
|
|
1385
1387
|
const node = createNodeByType(type, position, void 0, meta);
|
|
1386
|
-
__privateSet(this, _draftNode, createCanvasNodeByType(this, type, node));
|
|
1388
|
+
__privateSet(this, _draftNode, createCanvasNodeByType(this, type, node, true));
|
|
1387
1389
|
if (!__privateGet(this, _draftNode)) return;
|
|
1388
1390
|
__privateGet(this, _mainLayer).add(__privateGet(this, _draftNode).getElement());
|
|
1389
1391
|
}
|
|
@@ -1683,9 +1685,10 @@ class CanvasApi extends CanvasCore {
|
|
|
1683
1685
|
* 删除指定的节点
|
|
1684
1686
|
* 如果删除的是 image 节点,会同步删除所有关联的 image-marker
|
|
1685
1687
|
* @param nodeIds - 要删除的节点 ID 数组
|
|
1688
|
+
* @returns 被删除的节点数据数组
|
|
1686
1689
|
*/
|
|
1687
1690
|
deleteNodes(nodeIds) {
|
|
1688
|
-
if (nodeIds.length === 0) return;
|
|
1691
|
+
if (nodeIds.length === 0) return [];
|
|
1689
1692
|
const nodes = this.getState().nodes || [];
|
|
1690
1693
|
const idsToDelete = new Set(nodeIds);
|
|
1691
1694
|
nodeIds.forEach((id) => {
|
|
@@ -1698,6 +1701,7 @@ class CanvasApi extends CanvasCore {
|
|
|
1698
1701
|
});
|
|
1699
1702
|
}
|
|
1700
1703
|
});
|
|
1704
|
+
const deletedNodes = nodes.filter((n) => idsToDelete.has(n.id));
|
|
1701
1705
|
idsToDelete.forEach((id) => {
|
|
1702
1706
|
const shape = this.getStage().findOne(`#${id}`);
|
|
1703
1707
|
if (shape) {
|
|
@@ -1713,7 +1717,8 @@ class CanvasApi extends CanvasCore {
|
|
|
1713
1717
|
},
|
|
1714
1718
|
true
|
|
1715
1719
|
);
|
|
1716
|
-
this.emit("nodes:deleted",
|
|
1720
|
+
this.emit("nodes:deleted", deletedNodes);
|
|
1721
|
+
return deletedNodes;
|
|
1717
1722
|
}
|
|
1718
1723
|
/**
|
|
1719
1724
|
* 滚动到内容区域
|
package/dist/index.umd.js
CHANGED
|
@@ -1829,12 +1829,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1829
1829
|
MIN_SIZE: 10
|
|
1830
1830
|
};
|
|
1831
1831
|
class BaseCanvasNode {
|
|
1832
|
-
constructor(core, node) {
|
|
1832
|
+
constructor(core, node, isDraft = false) {
|
|
1833
1833
|
__publicField(this, "core");
|
|
1834
1834
|
__publicField(this, "node");
|
|
1835
1835
|
__publicField(this, "element");
|
|
1836
|
+
__publicField(this, "isDraft");
|
|
1836
1837
|
this.core = core;
|
|
1837
1838
|
this.node = node;
|
|
1839
|
+
this.isDraft = isDraft;
|
|
1838
1840
|
this.element = this.createElement();
|
|
1839
1841
|
}
|
|
1840
1842
|
/**
|
|
@@ -1857,8 +1859,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1857
1859
|
};
|
|
1858
1860
|
}
|
|
1859
1861
|
class RectNode extends BaseCanvasNode {
|
|
1860
|
-
constructor(core, node) {
|
|
1861
|
-
super(core, node);
|
|
1862
|
+
constructor(core, node, isDraft = false) {
|
|
1863
|
+
super(core, node, isDraft);
|
|
1862
1864
|
__privateAdd(this, _RectNode_instances);
|
|
1863
1865
|
__privateAdd(this, _toolTypeChangeHandler, (toolType) => {
|
|
1864
1866
|
const isSelect = toolType === "select";
|
|
@@ -1983,8 +1985,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1983
1985
|
});
|
|
1984
1986
|
};
|
|
1985
1987
|
class ImageNode extends BaseCanvasNode {
|
|
1986
|
-
constructor(core, node) {
|
|
1987
|
-
super(core, node);
|
|
1988
|
+
constructor(core, node, isDraft = false) {
|
|
1989
|
+
super(core, node, isDraft);
|
|
1988
1990
|
__privateAdd(this, _ImageNode_instances);
|
|
1989
1991
|
__privateAdd(this, _toolTypeChangeHandler2, (toolType) => {
|
|
1990
1992
|
const isSelect = toolType === "select";
|
|
@@ -2191,8 +2193,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2191
2193
|
});
|
|
2192
2194
|
};
|
|
2193
2195
|
class ImageMarkerNode extends BaseCanvasNode {
|
|
2194
|
-
constructor(core, node) {
|
|
2195
|
-
super(core, node);
|
|
2196
|
+
constructor(core, node, isDraft = false) {
|
|
2197
|
+
super(core, node, isDraft);
|
|
2196
2198
|
__privateAdd(this, _ImageMarkerNode_instances);
|
|
2197
2199
|
__privateAdd(this, _rect);
|
|
2198
2200
|
__privateAdd(this, _markerGroup);
|
|
@@ -2216,12 +2218,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2216
2218
|
);
|
|
2217
2219
|
const group = new Konva.Group({
|
|
2218
2220
|
id: this.node.id,
|
|
2219
|
-
name: `static ${this.node.meta.parent}`,
|
|
2221
|
+
name: `static ${this.node.meta.parent} imageMarker`,
|
|
2220
2222
|
x: this.node.props.x,
|
|
2221
2223
|
y: this.node.props.y,
|
|
2222
2224
|
width,
|
|
2223
|
-
height
|
|
2224
|
-
listening: false
|
|
2225
|
+
height
|
|
2225
2226
|
});
|
|
2226
2227
|
const rect = new Konva.Rect({
|
|
2227
2228
|
name: "rect",
|
|
@@ -2233,12 +2234,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2233
2234
|
strokeWidth: 2,
|
|
2234
2235
|
dash: [5, 5],
|
|
2235
2236
|
fill: "transparent",
|
|
2236
|
-
cornerRadius: RECT.CORNER_RADIUS
|
|
2237
|
+
cornerRadius: RECT.CORNER_RADIUS,
|
|
2238
|
+
listening: false
|
|
2237
2239
|
});
|
|
2238
2240
|
const markerGroup = new Konva.Group({
|
|
2239
2241
|
name: "marker-group",
|
|
2240
2242
|
x: width,
|
|
2241
|
-
y: height
|
|
2243
|
+
y: height,
|
|
2244
|
+
visible: this.isDraft ? false : true
|
|
2242
2245
|
});
|
|
2243
2246
|
const stageScale = this.core.getStageScale();
|
|
2244
2247
|
const radius = 16 / stageScale;
|
|
@@ -2325,7 +2328,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2325
2328
|
* 更新焦点状态(hover 或 selected)
|
|
2326
2329
|
*/
|
|
2327
2330
|
setFocusState(isFocus) {
|
|
2328
|
-
const strokeWidth = isFocus ?
|
|
2331
|
+
const strokeWidth = isFocus ? 4 : 2;
|
|
2329
2332
|
const scale = isFocus ? 1.2 : 1;
|
|
2330
2333
|
__privateGet(this, _rect).strokeWidth(strokeWidth);
|
|
2331
2334
|
__privateGet(this, _circle).strokeWidth(strokeWidth);
|
|
@@ -2356,14 +2359,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2356
2359
|
this.core.selectNode(this.node.id);
|
|
2357
2360
|
});
|
|
2358
2361
|
};
|
|
2359
|
-
function createCanvasNodeByType(core, type, config) {
|
|
2362
|
+
function createCanvasNodeByType(core, type, config, isDraft = false) {
|
|
2360
2363
|
switch (type) {
|
|
2361
2364
|
case "rectangle":
|
|
2362
|
-
return new RectNode(core, config);
|
|
2365
|
+
return new RectNode(core, config, isDraft);
|
|
2363
2366
|
case "image":
|
|
2364
|
-
return new ImageNode(core, config);
|
|
2367
|
+
return new ImageNode(core, config, isDraft);
|
|
2365
2368
|
case "image-marker":
|
|
2366
|
-
return new ImageMarkerNode(core, config);
|
|
2369
|
+
return new ImageMarkerNode(core, config, isDraft);
|
|
2367
2370
|
default:
|
|
2368
2371
|
return null;
|
|
2369
2372
|
}
|
|
@@ -2594,7 +2597,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2594
2597
|
__privateGet(this, _canvasTransformer).emitPositionChange();
|
|
2595
2598
|
}
|
|
2596
2599
|
createNodes(nodes) {
|
|
2597
|
-
const canvasNodes = nodes.map((node) => createCanvasNodeByType(this, node.type, node)).filter((node) => node !== null);
|
|
2600
|
+
const canvasNodes = nodes.map((node) => createCanvasNodeByType(this, node.type, node, false)).filter((node) => node !== null);
|
|
2598
2601
|
canvasNodes.forEach((node) => {
|
|
2599
2602
|
__privateGet(this, _mainLayer).add(node.getElement());
|
|
2600
2603
|
});
|
|
@@ -2665,26 +2668,25 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2665
2668
|
* @internal 仅供内部使用
|
|
2666
2669
|
*/
|
|
2667
2670
|
findImageAtPosition(position) {
|
|
2668
|
-
const layer = __privateGet(this, _mainLayer)
|
|
2669
|
-
const
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
const originalListeningStates = imageShapes.map(
|
|
2673
|
-
(shape) => shape.listening()
|
|
2671
|
+
const layer = __privateGet(this, _mainLayer);
|
|
2672
|
+
const shapes = layer.getChildren();
|
|
2673
|
+
const filteredShapes = shapes.filter(
|
|
2674
|
+
(shape) => !shape.name().includes("imageMarker")
|
|
2674
2675
|
);
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
const
|
|
2679
|
-
|
|
2680
|
-
|
|
2676
|
+
const sortedShapes = filteredShapes.slice().sort((a, b) => b.zIndex() - a.zIndex());
|
|
2677
|
+
for (const shape of sortedShapes) {
|
|
2678
|
+
const x = shape.x();
|
|
2679
|
+
const y = shape.y();
|
|
2680
|
+
const width = shape.width();
|
|
2681
|
+
const height = shape.height();
|
|
2682
|
+
if (position.x >= x && position.x <= x + width && position.y >= y && position.y <= y + height) {
|
|
2683
|
+
if (shape.getClassName() === "Image") {
|
|
2684
|
+
return shape;
|
|
2685
|
+
}
|
|
2686
|
+
return null;
|
|
2681
2687
|
}
|
|
2682
|
-
return null;
|
|
2683
|
-
} finally {
|
|
2684
|
-
imageShapes.forEach((shape, index) => {
|
|
2685
|
-
shape.listening(originalListeningStates[index]);
|
|
2686
|
-
});
|
|
2687
2688
|
}
|
|
2689
|
+
return null;
|
|
2688
2690
|
}
|
|
2689
2691
|
/**
|
|
2690
2692
|
* @internal 仅供内部使用
|
|
@@ -2694,7 +2696,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2694
2696
|
__privateGet(this, _draftNode).destroy();
|
|
2695
2697
|
}
|
|
2696
2698
|
const node = createNodeByType(type, position, void 0, meta);
|
|
2697
|
-
__privateSet(this, _draftNode, createCanvasNodeByType(this, type, node));
|
|
2699
|
+
__privateSet(this, _draftNode, createCanvasNodeByType(this, type, node, true));
|
|
2698
2700
|
if (!__privateGet(this, _draftNode)) return;
|
|
2699
2701
|
__privateGet(this, _mainLayer).add(__privateGet(this, _draftNode).getElement());
|
|
2700
2702
|
}
|
|
@@ -2994,9 +2996,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2994
2996
|
* 删除指定的节点
|
|
2995
2997
|
* 如果删除的是 image 节点,会同步删除所有关联的 image-marker
|
|
2996
2998
|
* @param nodeIds - 要删除的节点 ID 数组
|
|
2999
|
+
* @returns 被删除的节点数据数组
|
|
2997
3000
|
*/
|
|
2998
3001
|
deleteNodes(nodeIds) {
|
|
2999
|
-
if (nodeIds.length === 0) return;
|
|
3002
|
+
if (nodeIds.length === 0) return [];
|
|
3000
3003
|
const nodes = this.getState().nodes || [];
|
|
3001
3004
|
const idsToDelete = new Set(nodeIds);
|
|
3002
3005
|
nodeIds.forEach((id) => {
|
|
@@ -3009,6 +3012,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3009
3012
|
});
|
|
3010
3013
|
}
|
|
3011
3014
|
});
|
|
3015
|
+
const deletedNodes = nodes.filter((n) => idsToDelete.has(n.id));
|
|
3012
3016
|
idsToDelete.forEach((id) => {
|
|
3013
3017
|
const shape = this.getStage().findOne(`#${id}`);
|
|
3014
3018
|
if (shape) {
|
|
@@ -3024,7 +3028,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3024
3028
|
},
|
|
3025
3029
|
true
|
|
3026
3030
|
);
|
|
3027
|
-
this.emit("nodes:deleted",
|
|
3031
|
+
this.emit("nodes:deleted", deletedNodes);
|
|
3032
|
+
return deletedNodes;
|
|
3028
3033
|
}
|
|
3029
3034
|
/**
|
|
3030
3035
|
* 滚动到内容区域
|