From 88f8e3bab668e4fe95d9abcb189f3116a7ca7da1 Mon Sep 17 00:00:00 2001 From: "marcin.sciesinski" Date: Mon, 22 Feb 2021 09:10:16 -0800 Subject: [PATCH] Improving the client side performance - doing just one layout after all cards are added --- .../src/main/web/js/gemp-022/deckBuildingUi.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/deckBuildingUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/deckBuildingUi.js index e0dcf6801..ef43234ea 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/deckBuildingUi.js +++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/deckBuildingUi.js @@ -361,11 +361,12 @@ var GempLotrDeckBuildingUI = Class.extend({ } else if (group == "ring") { that.addCardToContainer(blueprintId, "special", that.ringDiv, false).addClass("cardInDeck"); } else { - that.addCardToDeckAndLayout(blueprintId, side); + that.addCardToDeckDontLayout(blueprintId, side); } } } - that.layoutSpecialGroups(); + that.deckModified(true); + that.layoutDeck(); $("#editingDeck").text("Imported Deck (unsaved)"); }); }, @@ -709,6 +710,18 @@ var GempLotrDeckBuildingUI = Class.extend({ this.selectionFunc = this.addCardToDeckAndLayout; }, + addCardToDeckDontLayout:function (blueprintId, side) { + var that = this; + if (side == "FREE_PEOPLE") { + this.addCardToDeck(blueprintId, side); + } else if (side == "SHADOW") { + this.addCardToDeck(blueprintId, side); + } else if (side == null) { + var div = this.addCardToContainer(blueprintId, side, this.siteDiv, false) + div.addClass("cardInDeck"); + } + }, + addCardToDeckAndLayout:function (blueprintId, side) { var that = this; if (side == "FREE_PEOPLE") { @@ -948,7 +961,6 @@ var GempLotrDeckBuildingUI = Class.extend({ this.ringBearerGroup.layoutCards(); this.ringGroup.layoutCards(); this.siteGroup.layoutCards(); - }, layoutDeck:function () {