|
@@ -10,12 +10,13 @@
|
|
|
import {createVNode, getCurrentInstance, inject, nextTick, onMounted, provide, reactive, ref, render, watch} from "vue";
|
|
|
import {Graph, Markup, Shape} from '@antv/x6'
|
|
|
import {WorkflowFunc} from "@/views/workflow/types";
|
|
|
-import {lineStyle, portStyle} from "@/views/workflow/config";
|
|
|
+import {lineStyle} from "@/views/workflow/config";
|
|
|
import nodeAdd from './node-add.vue'
|
|
|
import {register} from "@antv/x6-vue-shape";
|
|
|
import WorkflowNode from "@/views/workflow/nodes/index.vue";
|
|
|
-import {merge} from "lodash";
|
|
|
import {handleEdge, handleNode} from "@/views/workflow/handle";
|
|
|
+import { Snapline } from '@antv/x6-plugin-snapline'
|
|
|
+import {ContextMenuTool} from "./context-menu-tool";
|
|
|
|
|
|
const workflowFuncInject = inject('workflowFunc', {} as WorkflowFunc)
|
|
|
register({
|
|
@@ -68,6 +69,8 @@ Graph.registerPortLayout('more', (portsPositionArgs, elemBBox) => {
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
+Graph.registerNodeTool('contextmenu', ContextMenuTool, true)
|
|
|
+Graph.registerEdgeTool('contextmenu', ContextMenuTool, true)
|
|
|
const emits = defineEmits(['init'])
|
|
|
const props = defineProps({
|
|
|
data: <any>{}
|
|
@@ -145,6 +148,12 @@ const initChart = () => {
|
|
|
initNodes()
|
|
|
state.graph.zoomToFit({ maxScale: 1 })
|
|
|
state.graph.centerContent() // 居中显示
|
|
|
+ state.graph.use(
|
|
|
+ new Snapline({
|
|
|
+ enabled: true,
|
|
|
+ clean: false,
|
|
|
+ }),
|
|
|
+ )
|
|
|
initWatch()
|
|
|
emits('init', state.graph)
|
|
|
}
|