Tweak min item width increase

This commit is contained in:
drdev
2014-07-01 04:59:11 +00:00
parent 8ff91cd800
commit c6aeb45d0f
3 changed files with 4 additions and 7 deletions

View File

@@ -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;
}
}

View File

@@ -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;

View File

@@ -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;