Skip to content

Commit ab86cb1

Browse files
committed
【代码评审】BPM:增加流程图 小手功能
1 parent 1a4c94b commit ab86cb1

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

src/components/SimpleProcessDesignerV2/src/SimpleProcessModel.vue

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ const emits = defineEmits<{
8585
const processNodeTree = useWatchNode(props)
8686
8787
provide('readonly', props.readonly)
88+
89+
// TODO 可优化:拖拽有点卡顿
90+
/** 拖拽、放大缩小等操作 */
8891
let scaleValue = ref(100)
8992
const MAX_SCALE_VALUE = 200
9093
const MIN_SCALE_VALUE = 50
91-
9294
const isDragging = ref(false)
9395
const startX = ref(0)
9496
const startY = ref(0)
@@ -128,10 +130,33 @@ const stopDrag = () => {
128130
resetCursor() // 重置光标
129131
}
130132
133+
const zoomIn = () => {
134+
if (scaleValue.value == MAX_SCALE_VALUE) {
135+
return
136+
}
137+
scaleValue.value += 10
138+
}
139+
140+
const zoomOut = () => {
141+
if (scaleValue.value == MIN_SCALE_VALUE) {
142+
return
143+
}
144+
scaleValue.value -= 10
145+
}
146+
147+
const processReZoom = () => {
148+
scaleValue.value = 100
149+
}
150+
151+
const resetPosition = () => {
152+
currentX.value = initialX.value
153+
currentY.value = initialY.value
154+
}
155+
156+
/** 校验节点设置 */
131157
const errorDialogVisible = ref(false)
132158
let errorNodes: SimpleFlowNode[] = []
133159
134-
// 校验节点设置。 暂时以 showText 为空 未节点错误配置
135160
const validateNode = (node: SimpleFlowNode | undefined, errorNodes: SimpleFlowNode[]) => {
136161
if (node) {
137162
const { type, showText, conditionNodes } = node
@@ -212,37 +237,11 @@ const importLocalFile = () => {
212237
}
213238
}
214239
215-
// 放大
216-
const zoomIn = () => {
217-
if (scaleValue.value == MAX_SCALE_VALUE) {
218-
return
219-
}
220-
scaleValue.value += 10
221-
}
222-
223-
// 缩小
224-
const zoomOut = () => {
225-
if (scaleValue.value == MIN_SCALE_VALUE) {
226-
return
227-
}
228-
scaleValue.value -= 10
229-
}
230-
231-
const processReZoom = () => {
232-
scaleValue.value = 100
233-
}
234-
235240
// 在组件初始化时记录初始位置
236241
onMounted(() => {
237242
initialX.value = currentX.value
238243
initialY.value = currentY.value
239244
})
240-
241-
// 重置位置的函数
242-
const resetPosition = () => {
243-
currentX.value = initialX.value
244-
currentY.value = initialY.value
245-
}
246245
</script>
247246

248247
<style lang="scss" scoped>

0 commit comments

Comments
 (0)