mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Tweak min item width increase
This commit is contained in:
@@ -39,7 +39,7 @@ public abstract class FDropDownMenu extends FDropDown {
|
||||
float width = 0;
|
||||
for (FMenuItem item : items) {
|
||||
float minWidth = item.getMinWidth();
|
||||
if (minWidth > width) {
|
||||
if (width < minWidth) {
|
||||
width = minWidth;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import forge.util.Utils;
|
||||
|
||||
public class FMenuItem extends FDisplayObject {
|
||||
public static final float HEIGHT = Utils.AVG_FINGER_HEIGHT * 0.8f;
|
||||
protected static final float DIVOT_WIDTH = HEIGHT / 6;
|
||||
protected static final float GAP_X = HEIGHT * 0.1f;
|
||||
private static final float ICON_SIZE = ((int)((HEIGHT - 2 * GAP_X) / 20f)) * 20; //round down to nearest multiple of 20
|
||||
|
||||
@@ -60,17 +61,13 @@ public class FMenuItem extends FDisplayObject {
|
||||
|
||||
public float getMinWidth() {
|
||||
//pretend there's a divot even if there isn't to provide extra right padding and allow menu items to line up nicer
|
||||
float width = textWidth + getDivotWidth() + 4 * GAP_X;
|
||||
float width = textWidth + DIVOT_WIDTH + 4 * GAP_X;
|
||||
if (allowForIcon) {
|
||||
width += ICON_SIZE + GAP_X;
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
protected float getDivotWidth() {
|
||||
return getHeight() / 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean press(float x, float y) {
|
||||
pressed = true;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class FSubMenu extends FMenuItem {
|
||||
public void draw(Graphics g) {
|
||||
super.draw(g);
|
||||
|
||||
float divotWidth = getDivotWidth();
|
||||
float divotWidth = DIVOT_WIDTH;
|
||||
float divotHeight = divotWidth * 2f;
|
||||
float x2 = getWidth() - GAP_X - 1;
|
||||
float x1 = x2 - divotWidth;
|
||||
|
||||
Reference in New Issue
Block a user