-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathNodeControl.vue
More file actions
110 lines (108 loc) · 3.05 KB
/
NodeControl.vue
File metadata and controls
110 lines (108 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<template>
<el-card shadow="always" style="--el-card-padding: 8px 12px; --el-card-border-radius: 8px">
<el-button link @click="zoomOut" style="border: none">
<el-tooltip
effect="dark"
:content="$t('views.applicationWorkflow.control.zoomOut')"
placement="top"
>
<el-icon :size="16" :title="$t('views.applicationWorkflow.control.zoomOut')"
><ZoomOut
/></el-icon>
</el-tooltip>
</el-button>
<el-button link @click="zoomIn" style="border: none">
<el-tooltip
effect="dark"
:content="$t('views.applicationWorkflow.control.zoomIn')"
placement="top"
>
<el-icon :size="16" :title="$t('views.applicationWorkflow.control.zoomIn')"
><ZoomIn
/></el-icon>
</el-tooltip>
</el-button>
<el-button link @click="fitView" style="border: none">
<el-tooltip
effect="dark"
:content="$t('views.applicationWorkflow.control.fitView')"
placement="top"
>
<AppIcon
iconName="app-fitview"
:title="$t('views.applicationWorkflow.control.fitView')"
></AppIcon>
</el-tooltip>
</el-button>
<el-divider direction="vertical" />
<el-button link @click="retract" style="border: none">
<el-tooltip
effect="dark"
:content="$t('views.applicationWorkflow.control.retract')"
placement="top"
>
<AppIcon
style="font-size: 16px"
iconName="app-retract"
:title="$t('views.applicationWorkflow.control.retract')"
></AppIcon>
</el-tooltip>
</el-button>
<el-button link @click="extend" style="border: none">
<el-tooltip
effect="dark"
:content="$t('views.applicationWorkflow.control.extend')"
placement="top"
>
<AppIcon
style="font-size: 16px"
iconName="app-extend"
:title="$t('views.applicationWorkflow.control.extend')"
></AppIcon>
</el-tooltip>
</el-button>
<el-button link @click="layout" style="border: none">
<el-tooltip
effect="dark"
:content="$t('views.applicationWorkflow.control.beautify')"
placement="top"
>
<AppIcon
style="font-size: 16px"
iconName="app-beautify"
:title="$t('views.applicationWorkflow.control.beautify')"
></AppIcon>
</el-tooltip>
</el-button>
</el-card>
</template>
<script setup lang="ts">
const props = defineProps({
lf: Object || String || null,
})
function zoomIn() {
props.lf?.zoom(true, [0, 0])
}
function zoomOut() {
props.lf?.zoom(false, [0, 0])
}
function fitView() {
props.lf?.resetZoom()
props.lf?.resetTranslate()
props.lf?.fitView()
}
const layout = () => {
props.lf?.extension.dagre.layout()
}
const retract = () => {
props.lf?.graphModel.nodes.forEach((element: any) => {
element.properties.showNode = false
})
}
const extend = () => {
props.lf?.graphModel.nodes.forEach((element: any) => {
element.properties.showNode = true
})
}
</script>
<style scoped></style>