Merge pull request #2027 from draxdyn/resize_editor

Update image when cards in editor are resized
This commit is contained in:
LevelX2 2016-06-28 09:08:37 +02:00 committed by GitHub
commit c505c2f44f

View file

@ -634,6 +634,11 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
@Override @Override
public final void setCardBounds(int x, int y, int cardWidth, int cardHeight) { public final void setCardBounds(int x, int y, int cardWidth, int cardHeight) {
if(cardWidth == this.cardWidth && cardHeight == this.cardHeight) {
setBounds(x - cardXOffset, y - cardYOffset, getWidth(), getHeight());
return;
}
this.cardWidth = cardWidth; this.cardWidth = cardWidth;
this.symbolWidth = cardWidth / 7; this.symbolWidth = cardWidth / 7;
this.cardHeight = cardHeight; this.cardHeight = cardHeight;
@ -656,6 +661,8 @@ public class CardPanel extends MagePermanent implements MouseListener, MouseMoti
int height = cardYOffset * 2 + cardHeight; int height = cardYOffset * 2 + cardHeight;
setBounds(x - cardXOffset, y - cardYOffset, width, height); setBounds(x - cardXOffset, y - cardYOffset, width, height);
} }
if(imagePanel != null && imagePanel.getSrcImage() != null)
updateImage();
} }
public int getXOffset(int cardWidth) { public int getXOffset(int cardWidth) {