Fixing the display of cardAffectsCard to take into account horizontal cards (sites).

This commit is contained in:
marcins78@gmail.com
2011-11-03 23:04:28 +00:00
parent abf09cfb40
commit 330741283d

View File

@@ -137,28 +137,38 @@ var GameAnimations = Class.extend({
var targetCardWidth = $(targetCard).width();
var targetCardHeight = $(targetCard).height();
var shadowStartPosX;
var shadowStartPosY;
var shadowWidth;
var shadowHeight;
if (card.horizontal != $(targetCard).data("card").horizontal) {
var tempSize = targetCardHeight;
targetCardHeight = targetCardWidth;
targetCardWidth = tempSize;
shadowWidth = targetCardHeight;
shadowHeight = targetCardWidth;
shadowStartPosX = $(targetCard).position().left - (shadowWidth - targetCardWidth) / 2;
shadowStartPosY = $(targetCard).position().top - (shadowHeight - targetCardHeight) / 2;
} else {
shadowWidth = targetCardWidth;
shadowHeight = targetCardHeight;
shadowStartPosX = $(targetCard).position().left;
shadowStartPosY = $(targetCard).position().top;
}
$(cardDiv).css(
{
position: "absolute",
left: $(targetCard).position().left,
top: $(targetCard).position().top,
width: targetCardWidth,
height: targetCardHeight,
left: shadowStartPosX,
top: shadowStartPosY,
width: shadowWidth,
height: shadowHeight,
"z-index": 100,
opacity: 1});
$(cardDiv).animate(
{
opacity: 0,
left: "-=" + (targetCardWidth / 2),
top: "-=" + (targetCardHeight / 2),
width: "+=" + targetCardWidth,
height: "+=" + targetCardHeight},
left: "-=" + (shadowWidth / 2),
top: "-=" + (shadowHeight / 2),
width: "+=" + shadowWidth,
height: "+=" + shadowHeight},
{
duration: that.getAnimationLength(that.cardAffectsCardDuration),
easing: "easeInQuart",