Skip to content

Commit 91fc28c

Browse files
committed
Improvement - VueUiQuickChart - Donut mode: improve serie segregating animation timing
1 parent 87a6c2a commit 91fc28c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/components/vue-ui-quick-chart.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@ const isSegregatingDonut = ref(false);
275275
function segregateDonut(arc, ds) {
276276
isSegregatingDonut.value = true;
277277
let initVal = arc.value;
278+
const targetVal = fd.value.dataset.find((el, i) => arc.id === `donut_${i}`).VALUE;
278279
if(segregated.value.includes(arc.id)) {
279280
segregated.value = segregated.value.filter(el => el !== arc.id)
280-
const targetVal = fd.value.dataset.find((el, i) => arc.id === `donut_${i}`).VALUE;
281281
function animUp() {
282282
if(initVal > targetVal) {
283283
isSegregatingDonut.value = false;
@@ -292,7 +292,7 @@ function segregateDonut(arc, ds) {
292292
VALUE: targetVal
293293
}
294294
} else {
295-
return ds
295+
return ds;
296296
}
297297
})
298298
}
@@ -308,17 +308,17 @@ function segregateDonut(arc, ds) {
308308
VALUE: initVal
309309
}
310310
} else {
311-
return ds
311+
return ds;
312312
}
313313
})
314314
};
315-
rafUp.value = requestAnimationFrame(animUp)
315+
rafUp.value = requestAnimationFrame(animUp);
316316
}
317317
}
318318
animUp()
319319
} else if(ds.length > 1) {
320320
function anim() {
321-
if(initVal < 0.1) {
321+
if(initVal < targetVal / 100) {
322322
isSegregatingDonut.value = false;
323323
cancelAnimationFrame(raf.value)
324324
segregated.value.push(arc.id)
@@ -332,7 +332,7 @@ function segregateDonut(arc, ds) {
332332
VALUE: 0
333333
}
334334
} else {
335-
return ds
335+
return ds;
336336
}
337337
})
338338
}
@@ -348,14 +348,14 @@ function segregateDonut(arc, ds) {
348348
VALUE: initVal
349349
}
350350
} else {
351-
return ds
351+
return ds;
352352
}
353353
})
354354
}
355-
raf.value = requestAnimationFrame(anim)
355+
raf.value = requestAnimationFrame(anim);
356356
}
357357
}
358-
anim()
358+
anim();
359359
}
360360
}
361361

0 commit comments

Comments
 (0)