From 71e75bb8051dc56f396fb62d916a5a5ba2f1a6fa Mon Sep 17 00:00:00 2001 From: Nicolas Fritz Date: Thu, 26 Jan 2023 16:56:08 +0100 Subject: [PATCH] refactoring: Bug gefixt beim Karten ziehen --- uno/web/Style.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/uno/web/Style.js b/uno/web/Style.js index 868db49..7dfc181 100644 --- a/uno/web/Style.js +++ b/uno/web/Style.js @@ -5,6 +5,8 @@ export default class Style { this._cardOnDeck = null; + this._drawCardRunnig = false; + this._firstDraw = $('#first-draw'); this._firstPut = $('#first-put'); @@ -88,6 +90,8 @@ export default class Style { } drawCardAnim(enable, playerDraw) { + if(this.drawCardRunning) return; + this.drawCardRunning = true; if (playerDraw) { @@ -101,6 +105,7 @@ export default class Style { this.firstDraw.css('top', '47vh'); this.firstDraw.css('min-width', '20vh'); this.firstDraw.css('opacity', '1'); + this.drawCardRunning = false; }, 500); } else { @@ -108,19 +113,12 @@ export default class Style { this.firstDraw.css('transition', 'min-width 0.35s, top 0.5s'); this.firstDraw.css('min-width', '27vh'); this.firstDraw.css('top', '50vh'); - - setTimeout(() => { - this.firstDraw.css('transition', '') - }, 500); } else { this.firstDraw.css('transition', 'min-width 1s, top 0.5s'); this.firstDraw.css('top', '47vh'); this.firstDraw.css('min-width', '20vh'); - - setTimeout(() => { - this.firstDraw.css('transition', '') - }, 1000); } + this.drawCardRunning = false; } } @@ -150,4 +148,12 @@ export default class Style { return this._firstPutAnim; } + get drawCardRunning(){ + return this._drawCardRunnig; + } + + set drawCardRunning(bool){ + this._drawCardRunnig = bool; + } + } \ No newline at end of file