mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Add logic to prevent overzoom of rotated split cards for forge-gui-mobile.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user