From 5b34f906c6bf14cecd84c267c29ab7c2f475c6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Thu, 11 Nov 2021 23:54:11 +0100 Subject: [PATCH] cancel if no cursors to animate. --- src/component/cursors.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/component/cursors.vue b/src/component/cursors.vue index c42dc053..de2fda35 100644 --- a/src/component/cursors.vue +++ b/src/component/cursors.vue @@ -127,9 +127,17 @@ this._points.push(pos) } - const startAnimation = this._percent > 1 || this._percent == 0 + // no cursors to animate + if (this._points.length == 0) { + return + } + + // start animation if not running + const percent = this._percent this._percent = 0 - if (startAnimation) this.canvasAnimate() + if (percent > 1 || percent == 0) { + this.canvasAnimate() + } } canvasRedraw(x: number, y: number, id: string) {