Fixes #108 "Right click in grid search field should clear contents of field"

This commit is contained in:
Raoul Van den Berge
2016-06-12 10:34:10 +02:00
parent b970ac3a8a
commit acad85891b
2 changed files with 18 additions and 4 deletions

View File

@@ -2,7 +2,10 @@
### 0.7.11
**Bugfixes**
- Fixed crash using wireless grid
- Fixed crash with wireless grid
**Features**
- Right click on grid search bar clears the search query
### 0.7.10
**Bugfixes**

View File

@@ -316,6 +316,13 @@ public class GuiGrid extends GuiBase {
searchField.mouseClicked(mouseX, mouseY, clickedButton);
if (clickedButton == 1 && inBounds(79, 5, 90, 12, mouseX - guiLeft, mouseY - guiTop)) {
searchField.setText("");
searchField.setFocused(true);
updateJEI();
}
boolean clickedClear = clickedButton == 0 && isHoveringOverClear(mouseX - guiLeft, mouseY - guiTop);
boolean clickedCreatePattern = clickedButton == 0 && isHoveringOverCreatePattern(mouseX - guiLeft, mouseY - guiTop);
@@ -377,14 +384,18 @@ public class GuiGrid extends GuiBase {
@Override
protected void keyTyped(char character, int keyCode) throws IOException {
if (!checkHotbarKeys(keyCode) && searchField.textboxKeyTyped(character, keyCode)) {
if (RefinedStorage.hasJei() && (grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED || grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED)) {
RefinedStorageJEIPlugin.INSTANCE.getRuntime().getItemListOverlay().setFilterText(searchField.getText());
}
updateJEI();
} else {
super.keyTyped(character, keyCode);
}
}
private void updateJEI() {
if (RefinedStorage.hasJei() && (grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED || grid.getSearchBoxMode() == TileGrid.SEARCH_BOX_MODE_JEI_SYNCHRONIZED_AUTOSELECTED)) {
RefinedStorageJEIPlugin.INSTANCE.getRuntime().getItemListOverlay().setFilterText(searchField.getText());
}
}
public int getVisibleRows() {
return (grid.getType() == EnumGridType.CRAFTING || grid.getType() == EnumGridType.PATTERN) ? 4 : 5;
}