chore(docs): cancel upcoming tasks if stopped

This commit is contained in:
braks
2024-02-08 20:07:50 +01:00
committed by Braks
parent caf874dd49
commit 51c0ee065b
2 changed files with 25 additions and 1 deletions
+9 -1
View File
@@ -60,6 +60,8 @@ const sourceNodeData = toRef(() => nodesData.value[1])
const isFinished = toRef(() => sourceNodeData.value.isFinished)
const isCancelled = toRef(() => targetNodeData.value.isCancelled)
const isAnimating = ref(false)
const edgeColor = toRef(() => {
@@ -84,6 +86,12 @@ const edgeColor = toRef(() => {
const path = computed(() => getSmoothStepPath(props))
watch(isCancelled, (isCancelled) => {
if (isCancelled) {
isAnimating.value = false
}
})
watch(isAnimating, (isAnimating) => {
const edge = findEdge(props.id)
@@ -98,7 +106,7 @@ watch(isAnimating, (isAnimating) => {
watch(edgePoint, (point) => {
const pathEl = edgeRef.value?.pathEl
if (!pathEl || point === 0) {
if (!pathEl || point === 0 || !isAnimating.value) {
return
}