Add logic to prevent overzoom of rotated split cards for forge-gui-mobile.

This commit is contained in:
Tim Scott
2019-02-22 22:06:40 -06:00
parent 38d3f76bb5
commit 22aa98bf92

View File

@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.badlogic.gdx.math.Rectangle;
@@ -220,11 +221,24 @@ public class CardZoom extends FOverlay {
float maxCardHeight = h - 2 * messageHeight;
float cardWidth, cardHeight, y;
if (oneCardView && !Forge.isLandscapeMode()) {
cardWidth = w;
cardHeight = FCardPanel.ASPECT_RATIO * cardWidth;
boolean rotateSplit = FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ROTATE_SPLIT_CARDS);
if (currentCard.isSplitCard() && rotateSplit) {
// card will be rotated. Make sure that the height does not exceed the width of the view
if (cardHeight > Gdx.graphics.getWidth())
{
cardHeight = Gdx.graphics.getWidth();
cardWidth = cardHeight / FCardPanel.ASPECT_RATIO;
}
}
}
else {
cardWidth = w * 0.5f;
cardHeight = FCardPanel.ASPECT_RATIO * cardWidth;