Browse Source

refactoring: Bug gefixt beim Karten ziehen

main
Nicolas Fritz 2 years ago
parent
commit
71e75bb805
  1. 22
      uno/web/Style.js

22
uno/web/Style.js

@ -5,6 +5,8 @@ export default class Style {
this._cardOnDeck = null; this._cardOnDeck = null;
this._drawCardRunnig = false;
this._firstDraw = $('#first-draw'); this._firstDraw = $('#first-draw');
this._firstPut = $('#first-put'); this._firstPut = $('#first-put');
@ -88,6 +90,8 @@ export default class Style {
} }
drawCardAnim(enable, playerDraw) { drawCardAnim(enable, playerDraw) {
if(this.drawCardRunning) return;
this.drawCardRunning = true;
if (playerDraw) { if (playerDraw) {
@ -101,6 +105,7 @@ export default class Style {
this.firstDraw.css('top', '47vh'); this.firstDraw.css('top', '47vh');
this.firstDraw.css('min-width', '20vh'); this.firstDraw.css('min-width', '20vh');
this.firstDraw.css('opacity', '1'); this.firstDraw.css('opacity', '1');
this.drawCardRunning = false;
}, 500); }, 500);
} else { } else {
@ -108,19 +113,12 @@ export default class Style {
this.firstDraw.css('transition', 'min-width 0.35s, top 0.5s'); this.firstDraw.css('transition', 'min-width 0.35s, top 0.5s');
this.firstDraw.css('min-width', '27vh'); this.firstDraw.css('min-width', '27vh');
this.firstDraw.css('top', '50vh'); this.firstDraw.css('top', '50vh');
setTimeout(() => {
this.firstDraw.css('transition', '')
}, 500);
} else { } else {
this.firstDraw.css('transition', 'min-width 1s, top 0.5s'); this.firstDraw.css('transition', 'min-width 1s, top 0.5s');
this.firstDraw.css('top', '47vh'); this.firstDraw.css('top', '47vh');
this.firstDraw.css('min-width', '20vh'); 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; return this._firstPutAnim;
} }
get drawCardRunning(){
return this._drawCardRunnig;
}
set drawCardRunning(bool){
this._drawCardRunnig = bool;
}
} }
Loading…
Cancel
Save