Skip to content

Commit f9c7446

Browse files
committed
增加流程图 小手功能 增加重置功能 移动流程位置后恢复原位置
1 parent 0212ef4 commit f9c7446

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/components/SimpleProcessDesignerV2/src/SimpleProcessModel.vue

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<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">
44
<el-row type="flex" justify="end">
55
<el-button-group key="scale-control" size="default">
66
<el-button v-if="!readonly" size="default" @click="exportJson">
@@ -23,6 +23,7 @@
2323
<el-button size="default" :plain="true" :icon="ZoomOut" @click="zoomOut()" />
2424
<el-button size="default" class="w-80px"> {{ scaleValue }}% </el-button>
2525
<el-button size="default" :plain="true" :icon="ZoomIn" @click="zoomIn()" />
26+
<el-button size="default" @click="resetPosition">重置</el-button>
2627
</el-button-group>
2728
</el-row>
2829
</div>
@@ -93,6 +94,8 @@ const startX = ref(0)
9394
const startY = ref(0)
9495
const currentX = ref(0)
9596
const currentY = ref(0)
97+
const initialX = ref(0)
98+
const initialY = ref(0)
9699
97100
const setGrabCursor = () => {
98101
document.body.style.cursor = 'grab';
@@ -238,6 +241,18 @@ const zoomOut = () => {
238241
const processReZoom = () => {
239242
scaleValue.value = 100
240243
}
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+
}
241256
</script>
242257

243258
<style lang="scss" scoped>
@@ -253,4 +268,8 @@ const processReZoom = () => {
253268
min-width: 100%; // 确保宽度为100%
254269
min-height: 100%; // 确保高度为100%
255270
}
271+
272+
.z-index-button-group {
273+
z-index: 10;
274+
}
256275
</style>

0 commit comments

Comments
 (0)