【代码评审】BPM:增加流程图 小手功能

This commit is contained in:
YunaiV 2025-02-19 13:41:38 +08:00
parent 3906204bb9
commit 1a4c94b830

View File

@ -98,49 +98,39 @@ const initialX = ref(0)
const initialY = ref(0) const initialY = ref(0)
const setGrabCursor = () => { const setGrabCursor = () => {
document.body.style.cursor = 'grab'; document.body.style.cursor = 'grab'
} }
const resetCursor = () => { const resetCursor = () => {
document.body.style.cursor = 'default'; document.body.style.cursor = 'default'
} }
const startDrag = (e: MouseEvent) => { const startDrag = (e: MouseEvent) => {
isDragging.value = true; isDragging.value = true
startX.value = e.clientX - currentX.value; startX.value = e.clientX - currentX.value
startY.value = e.clientY - currentY.value; startY.value = e.clientY - currentY.value
setGrabCursor(); // setGrabCursor() //
} }
const onDrag = (e: MouseEvent) => { const onDrag = (e: MouseEvent) => {
if (!isDragging.value) return; if (!isDragging.value) return
e.preventDefault(); // e.preventDefault() //
// 使 requestAnimationFrame // 使 requestAnimationFrame
requestAnimationFrame(() => { requestAnimationFrame(() => {
currentX.value = e.clientX - startX.value; currentX.value = e.clientX - startX.value
currentY.value = e.clientY - startY.value; currentY.value = e.clientY - startY.value
}); })
} }
const stopDrag = () => { const stopDrag = () => {
isDragging.value = false; isDragging.value = false
resetCursor(); // resetCursor() //
} }
const errorDialogVisible = ref(false) const errorDialogVisible = ref(false)
let errorNodes: SimpleFlowNode[] = [] let errorNodes: SimpleFlowNode[] = []
const saveSimpleFlowModel = async () => {
errorNodes = []
validateNode(processNodeTree.value, errorNodes)
if (errorNodes.length > 0) {
errorDialogVisible.value = true
return
}
emits('save', processNodeTree.value)
}
// showText // showText
const validateNode = (node: SimpleFlowNode | undefined, errorNodes: SimpleFlowNode[]) => { const validateNode = (node: SimpleFlowNode | undefined, errorNodes: SimpleFlowNode[]) => {
if (node) { if (node) {