这里通过 SelectSelection 与 GlobalDrag 两个插件,实现鼠标交互增强,包括:
import LogicFlow from "@logicflow/core";import { SelectionSelect } from "@logicflow/extension";import { GlobalDrag } from "logicflow-plugin-global-drag"; const lf = new LogicFlow({ container: document.querySelector("#container")!, plugins: [GlobalDrag, SelectionSelect], keyboard: { enabled: true, },}); (lf.extension.selectionSelect as SelectionSelect).openSelectionSelect(); const data = { nodes: [ { id: '10', type: "rect", x: 100, y: 100, text: "Hello", }, { id: '20', type: "circle", x: 300, y: 100, text: "World", }, { id: '30', type: "circle", x: 300, y: 300, text: "New World", }, ], edges: [ { type: "line", sourceNodeId: '10', targetNodeId: '20', }, ],}; lf.render(data);