|
@@ -105,7 +105,7 @@
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import {createVNode, getCurrentInstance, nextTick, onMounted, reactive, ref, render, watch} from "vue";
|
|
import {createVNode, getCurrentInstance, nextTick, onMounted, reactive, ref, render, watch} from "vue";
|
|
import {Graph, Path, Shape} from '@antv/x6'
|
|
import {Graph, Path, Shape} from '@antv/x6'
|
|
-import {getNodeDefault, lineStyle} from "@/views/workflow/config";
|
|
|
|
|
|
+import {getNodeDefault, lineActiveStyle, lineStyle} from "@/views/workflow/config";
|
|
import nodeAdd from './node-add.vue'
|
|
import nodeAdd from './node-add.vue'
|
|
import {register} from "@antv/x6-vue-shape";
|
|
import {register} from "@antv/x6-vue-shape";
|
|
import WorkflowNode from "./node-index.vue";
|
|
import WorkflowNode from "./node-index.vue";
|
|
@@ -365,6 +365,32 @@ const initWatch = () => {
|
|
state.isPort = false
|
|
state.isPort = false
|
|
}, 100)
|
|
}, 100)
|
|
})
|
|
})
|
|
|
|
+ state.graph.on('node:mouseenter', ({ e, node, view }) => {
|
|
|
|
+ const connectEdges = state.graph.getConnectedEdges(node.id)
|
|
|
|
+ connectEdges.forEach(edge => {
|
|
|
|
+ edge.attr(lineActiveStyle)
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ state.graph.on('node:mouseleave', ({ e, node, view }) => {
|
|
|
|
+ const connectEdges = state.graph.getConnectedEdges(node.id)
|
|
|
|
+ connectEdges.forEach(edge => {
|
|
|
|
+ edge.attr(lineStyle)
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ state.graph.on('edge:mouseenter', ({ e, edge, view }) => {
|
|
|
|
+ edge.attr(lineActiveStyle)
|
|
|
|
+ const connectNodes = state.graph.getNeighbors(edge)
|
|
|
|
+ connectNodes.forEach(node => {
|
|
|
|
+ node.attr('active', true)
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ state.graph.on('edge:mouseleave', ({ e, edge, view }) => {
|
|
|
|
+ edge.attr(lineStyle)
|
|
|
|
+ const connectNodes = state.graph.getNeighbors(edge)
|
|
|
|
+ connectNodes.forEach(node => {
|
|
|
|
+ node.attr('active', false)
|
|
|
|
+ })
|
|
|
|
+ })
|
|
state.graph.on('scale', ({ sx, sy, ox, oy }) => {
|
|
state.graph.on('scale', ({ sx, sy, ox, oy }) => {
|
|
state.zoom = sx
|
|
state.zoom = sx
|
|
})
|
|
})
|