mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 18:28:00 +00:00
Auto-focus ListChooser search field on desktop
Increase width of buttons on DualListBox Make border on ListChooser show up on certain themes
This commit is contained in:
@@ -151,7 +151,7 @@ public class DualListBox<T> extends FDialog {
|
|||||||
float buttonHeight = FOptionPane.BUTTON_HEIGHT;
|
float buttonHeight = FOptionPane.BUTTON_HEIGHT;
|
||||||
float labelHeight = selectOrder.getAutoSizeBounds().height;
|
float labelHeight = selectOrder.getAutoSizeBounds().height;
|
||||||
float listHeight = (maxHeight - 2 * labelHeight - buttonHeight - FOptionPane.PADDING - 2 * FDialog.INSETS) / 2;
|
float listHeight = (maxHeight - 2 * labelHeight - buttonHeight - FOptionPane.PADDING - 2 * FDialog.INSETS) / 2;
|
||||||
float addButtonWidth = addAllButton.getAutoSizeBounds().width;
|
float addButtonWidth = addAllButton.getAutoSizeBounds().width * 1.2f;
|
||||||
float addButtonHeight = listHeight / 2 - gapBetweenButtons;
|
float addButtonHeight = listHeight / 2 - gapBetweenButtons;
|
||||||
float listWidth = width - addButtonWidth - gapBetweenButtons;
|
float listWidth = width - addButtonWidth - gapBetweenButtons;
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,12 @@ public class FTextField extends FDisplayObject {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean tap(float x, float y, int count) {
|
public boolean tap(float x, float y, int count) {
|
||||||
if (keyInputActive) { return true; } //do nothing if key input already active
|
startEdit();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startEdit() {
|
||||||
|
if (keyInputActive) { return; } //do nothing if key input already active
|
||||||
|
|
||||||
selStart = 0; //select all before starting input
|
selStart = 0; //select all before starting input
|
||||||
selLength = text.length();
|
selLength = text.length();
|
||||||
@@ -224,7 +229,6 @@ public class FTextField extends FDisplayObject {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
keyInputActive = true;
|
keyInputActive = true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
|
|
||||||
package forge.toolbox;
|
package forge.toolbox;
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.Application.ApplicationType;
|
||||||
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
@@ -65,7 +67,7 @@ public class ListChooser<T> extends FContainer {
|
|||||||
public static final FSkinColor ITEM_COLOR = FSkinColor.get(Colors.CLR_ZEBRA);
|
public static final FSkinColor ITEM_COLOR = FSkinColor.get(Colors.CLR_ZEBRA);
|
||||||
public static final FSkinColor ALT_ITEM_COLOR = ITEM_COLOR.getContrastColor(-20);
|
public static final FSkinColor ALT_ITEM_COLOR = ITEM_COLOR.getContrastColor(-20);
|
||||||
public static final FSkinColor SEL_COLOR = FSkinColor.get(Colors.CLR_ACTIVE);
|
public static final FSkinColor SEL_COLOR = FSkinColor.get(Colors.CLR_ACTIVE);
|
||||||
public static final FSkinColor BORDER_COLOR = FSkinColor.get(Colors.CLR_BORDERS);
|
public static final FSkinColor BORDER_COLOR = FList.FORE_COLOR;
|
||||||
public static final float ITEM_HEIGHT = Utils.AVG_FINGER_HEIGHT * 0.75f;
|
public static final float ITEM_HEIGHT = Utils.AVG_FINGER_HEIGHT * 0.75f;
|
||||||
|
|
||||||
// Data and number of choices for the list
|
// Data and number of choices for the list
|
||||||
@@ -181,6 +183,9 @@ public class ListChooser<T> extends FContainer {
|
|||||||
}
|
}
|
||||||
onSelectionChange();
|
onSelectionChange();
|
||||||
optionPane.show();
|
optionPane.show();
|
||||||
|
if (txtSearch != null && Gdx.app.getType() == ApplicationType.Desktop) {
|
||||||
|
txtSearch.startEdit(); //automatically focus search textbox for edit if on desktop
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onSelectionChange() {
|
private void onSelectionChange() {
|
||||||
|
|||||||
Reference in New Issue
Block a user