Sites in adventure path with attached cards on them, should be given more space when layed out.

This commit is contained in:
marcins78@gmail.com
2011-11-26 22:13:42 +00:00
parent e123b772e7
commit bdc6908ebd

View File

@@ -133,8 +133,13 @@ var AdvPathCardGroup = CardGroup.extend({
var cardCount = cardsToLayout.length;
var totalHeight = 0;
for (var cardIndex in cardsToLayout)
totalHeight += cardsToLayout[cardIndex].data("card").getHeightForWidth(this.width);
for (var cardIndex in cardsToLayout) {
var cardData = cardsToLayout[cardIndex].data("card");
var cardHeight = cardData.getHeightForWidth(this.width);
totalHeight += cardHeight;
if (cardData.attachedCards.length > 0)
totalHeight += cardHeight * 0.2;
}
var resultPadding = Math.min(this.padding, (this.height - totalHeight) / (cardCount - 1));
@@ -146,6 +151,9 @@ var AdvPathCardGroup = CardGroup.extend({
var cardData = cardElem.data("card");
var cardHeight = (cardElem.data("card").getHeightForWidth(this.width));
if (cardData.attachedCards.length > 0)
y += cardHeight * 0.1;
cardData.tokens = {};
if (this.positions != null) {
for (var i = 0; i < this.positions.length; i++)
@@ -169,6 +177,9 @@ var AdvPathCardGroup = CardGroup.extend({
this.layoutCard(cardElem, x, y, this.width, cardHeight, index);
if (cardData.attachedCards.length > 0)
y += cardHeight * 0.1;
y += cardHeight + resultPadding;
index++;
}