From 4b11dd3210df8659241d5d7d555302f03d5cfc54 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Thu, 18 Aug 2022 02:24:31 -0400 Subject: Fix card data --- scripts/cards/card.js | 4 ---- scripts/gui/table.js | 9 +++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/scripts/cards/card.js b/scripts/cards/card.js index 352f2b3..69312e9 100644 --- a/scripts/cards/card.js +++ b/scripts/cards/card.js @@ -137,8 +137,4 @@ class Card { this.e.style.setProperty("--top", "0px"); this.e.className = ""; } - - getDeck() { - return this.deck; - } } diff --git a/scripts/gui/table.js b/scripts/gui/table.js index 51ed4b3..f19cfca 100644 --- a/scripts/gui/table.js +++ b/scripts/gui/table.js @@ -91,7 +91,7 @@ class Table{ // {data.deck} the id of the deck to add the card to newCard(data) { - let c = new Card(data.id, data.data); + let c = new Card(data.id, data.deck, data.data); this.cards[data.id] = c; this.decks[data.deck].appendCard(c); this.drag.addTarget(c.e); @@ -114,8 +114,9 @@ class Table{ // {id any} id of card to delete deleteCard(id) { - this.cards[id].getDeck().removeCardByID(id) - this.cards[id].e.remove(); + let c = this.cards[id]; + this.decks[c.deck].removeCardByID(id) + c.e.remove(); delete this.cards[id]; } @@ -127,7 +128,7 @@ class Table{ moveCard(data) { let c = this.cards[data.card]; - this.decks[c.getDeck()].removeCardByID(data.card); + this.decks[c.deck].removeCardByID(data.card); this.decks[data.deck].addCardAt(c, data.index); c.resetPos(); c.e.className = ""; -- cgit v1.2.3