1
This commit is contained in:
parent
fd90632e0f
commit
d1908582c1
@ -88,6 +88,14 @@ const WorkflowDesign: React.FC = () => {
|
||||
rubberband: true,
|
||||
movable: true,
|
||||
showNodeSelectionBox: true,
|
||||
strict: true,
|
||||
selectCellOnMoved: true,
|
||||
selectNodeOnMoved: true,
|
||||
selectEdgeOnMoved: true,
|
||||
multipleSelectionModifiers: ['ctrl', 'meta'],
|
||||
showEdgeSelectionBox: true,
|
||||
showAnchorSelectionBox: true,
|
||||
pointerEvents: 'auto'
|
||||
},
|
||||
snapline: true,
|
||||
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({
|
||||
container: minimapContainerRef.current!,
|
||||
width: minimapWidth,
|
||||
@ -782,18 +808,39 @@ const WorkflowDesign: React.FC = () => {
|
||||
</Tooltip>
|
||||
</Space.Compact>
|
||||
<Space.Compact>
|
||||
<Tooltip title="选择">
|
||||
<Tooltip title="全选">
|
||||
<Button
|
||||
icon={<SelectOutlined />}
|
||||
onClick={() => {
|
||||
if (!graph) return;
|
||||
|
||||
// 添加小延时确保图形已完全初始化
|
||||
setTimeout(() => {
|
||||
const cells = graph.getCells();
|
||||
console.log('All cells:', 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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user