From 8f3ec8dc9f94ea5a6249a126d5eb975136eac110 Mon Sep 17 00:00:00 2001 From: Nicolas Fritz Date: Thu, 26 Jan 2023 21:28:02 +0100 Subject: [PATCH] refactoring: Bei neuskalierung des Fensters anpassen --- uno/web/Style.js | 13 +++++++++---- uno/web/uno.js | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/uno/web/Style.js b/uno/web/Style.js index 8dff528..60f2110 100644 --- a/uno/web/Style.js +++ b/uno/web/Style.js @@ -36,6 +36,14 @@ export default class Style { } refreshHtml() { + this.refreshCardOnDeck(); + + this.showPlayerDeck(this.game.currentPlayerInstanz, true); + + this.refreshDebug(); + } + + refreshCardOnDeck(){ if (this._cardOnDeck !== this.game.cardOnDeck) { console.log(" ewfw") this.putCardAnim(); @@ -44,10 +52,6 @@ export default class Style { this.firstPut.attr('src', './img/stackCards/' + this.game.cardOnDeck.color + '/' + this.game.cardOnDeck.name + '.png'); this.firstPutAnim.attr('src', './img/stackCards/' + this.game.cardOnDeck.color + '/' + this.game.cardOnDeck.name + '.png'); } - - this.showPlayerDeck(this.game.currentPlayerInstanz, true); - - this.refreshDebug(); } refreshDebug() { @@ -136,6 +140,7 @@ export default class Style { player.putCard(i); card.css('top', yPos - height * 0.2); card.css('opacity', 0); + this.refreshCardOnDeck(); setTimeout(() => { this.refreshHtml(); diff --git a/uno/web/uno.js b/uno/web/uno.js index 88e1c59..d75814e 100644 --- a/uno/web/uno.js +++ b/uno/web/uno.js @@ -18,6 +18,11 @@ $(()=>{ style.showDebug(); style.refreshHtml(); + $(window).on('resize', function () { + style.refreshHtml(); + }) + + });