1
1
<template >
2
2
<div class =" simple-process-model-container position-relative" >
3
- <div class =" position-absolute top-0px right-0px bg-#fff" >
3
+ <div class =" position-absolute top-0px right-0px bg-#fff z-index-button-group " >
4
4
<el-row type =" flex" justify =" end" >
5
5
<el-button-group key =" scale-control" size =" default" >
6
6
<el-button v-if =" !readonly" size =" default" @click =" exportJson" >
23
23
<el-button size =" default" :plain =" true" :icon =" ZoomOut" @click =" zoomOut()" />
24
24
<el-button size =" default" class =" w-80px" > {{ scaleValue }}% </el-button >
25
25
<el-button size =" default" :plain =" true" :icon =" ZoomIn" @click =" zoomIn()" />
26
+ <el-button size =" default" @click =" resetPosition" >重置</el-button >
26
27
</el-button-group >
27
28
</el-row >
28
29
</div >
@@ -93,6 +94,8 @@ const startX = ref(0)
93
94
const startY = ref (0 )
94
95
const currentX = ref (0 )
95
96
const currentY = ref (0 )
97
+ const initialX = ref (0 )
98
+ const initialY = ref (0 )
96
99
97
100
const setGrabCursor = () => {
98
101
document .body .style .cursor = ' grab' ;
@@ -238,6 +241,18 @@ const zoomOut = () => {
238
241
const processReZoom = () => {
239
242
scaleValue .value = 100
240
243
}
244
+
245
+ // 在组件初始化时记录初始位置
246
+ onMounted (() => {
247
+ initialX .value = currentX .value
248
+ initialY .value = currentY .value
249
+ })
250
+
251
+ // 重置位置的函数
252
+ const resetPosition = () => {
253
+ currentX .value = initialX .value
254
+ currentY .value = initialY .value
255
+ }
241
256
</script >
242
257
243
258
<style lang="scss" scoped>
@@ -253,4 +268,8 @@ const processReZoom = () => {
253
268
min-width : 100% ; // 确保宽度为100%
254
269
min-height : 100% ; // 确保高度为100%
255
270
}
271
+
272
+ .z-index-button-group {
273
+ z-index : 10 ;
274
+ }
256
275
</style >
0 commit comments