1
This commit is contained in:
parent
fd90632e0f
commit
d1908582c1
@ -88,6 +88,14 @@ const WorkflowDesign: React.FC = () => {
|
|||||||
rubberband: true,
|
rubberband: true,
|
||||||
movable: true,
|
movable: true,
|
||||||
showNodeSelectionBox: true,
|
showNodeSelectionBox: true,
|
||||||
|
strict: true,
|
||||||
|
selectCellOnMoved: true,
|
||||||
|
selectNodeOnMoved: true,
|
||||||
|
selectEdgeOnMoved: true,
|
||||||
|
multipleSelectionModifiers: ['ctrl', 'meta'],
|
||||||
|
showEdgeSelectionBox: true,
|
||||||
|
showAnchorSelectionBox: true,
|
||||||
|
pointerEvents: 'auto'
|
||||||
},
|
},
|
||||||
snapline: true,
|
snapline: true,
|
||||||
keyboard: {
|
keyboard: {
|
||||||
@ -120,7 +128,25 @@ const WorkflowDesign: React.FC = () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
graph.use(new Selection());
|
// 初始化Selection插件
|
||||||
|
const selection = new Selection({
|
||||||
|
enabled: true,
|
||||||
|
multiple: true,
|
||||||
|
rubberband: true,
|
||||||
|
movable: true,
|
||||||
|
showNodeSelectionBox: true,
|
||||||
|
strict: true,
|
||||||
|
selectCellOnMoved: true,
|
||||||
|
selectNodeOnMoved: true,
|
||||||
|
selectEdgeOnMoved: true,
|
||||||
|
multipleSelectionModifiers: ['ctrl', 'meta'],
|
||||||
|
showEdgeSelectionBox: true,
|
||||||
|
showAnchorSelectionBox: true,
|
||||||
|
pointerEvents: 'auto'
|
||||||
|
});
|
||||||
|
console.log('Initializing Selection plugin:', selection);
|
||||||
|
graph.use(selection);
|
||||||
|
|
||||||
graph.use(new MiniMap({
|
graph.use(new MiniMap({
|
||||||
container: minimapContainerRef.current!,
|
container: minimapContainerRef.current!,
|
||||||
width: minimapWidth,
|
width: minimapWidth,
|
||||||
@ -782,18 +808,39 @@ const WorkflowDesign: React.FC = () => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Space.Compact>
|
</Space.Compact>
|
||||||
<Space.Compact>
|
<Space.Compact>
|
||||||
<Tooltip title="选择">
|
<Tooltip title="全选">
|
||||||
<Button
|
<Button
|
||||||
icon={<SelectOutlined />}
|
icon={<SelectOutlined />}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!graph) return;
|
if (!graph) return;
|
||||||
const cells = graph.getCells();
|
|
||||||
if (cells.length === 0) {
|
// 添加小延时确保图形已完全初始化
|
||||||
message.info('当前没有可选择的元素');
|
setTimeout(() => {
|
||||||
return;
|
const cells = graph.getCells();
|
||||||
}
|
console.log('All cells:', cells);
|
||||||
graph.resetSelection();
|
|
||||||
graph.select(cells);
|
if (cells.length === 0) {
|
||||||
|
message.info('当前没有可选择的元素');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打印当前选择状态
|
||||||
|
console.log('Current selection before reset:', graph.getSelectedCells());
|
||||||
|
graph.resetSelection();
|
||||||
|
console.log('Selection after reset:', graph.getSelectedCells());
|
||||||
|
|
||||||
|
// 尝试选择所有单元格
|
||||||
|
try {
|
||||||
|
graph.select(cells);
|
||||||
|
console.log('Selection after select all:', graph.getSelectedCells());
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error selecting cells:', error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查Selection插件是否正确初始化
|
||||||
|
const selection = graph.getPlugin('selection');
|
||||||
|
console.log('Selection plugin:', selection);
|
||||||
|
}, 100);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user