From 20a6e504aec150eb1cd09bf29ff93fb58a97b6bd Mon Sep 17 00:00:00 2001 From: sharrlotte Date: Wed, 12 Feb 2025 21:33:39 +0700 Subject: [PATCH] smaller scale --- src/mindytool/gui/FilterDialog.java | 7 +++-- src/mindytool/gui/MapDialog.java | 33 ++++++++++++++-------- src/mindytool/gui/SchematicDialog.java | 39 +++++++++++++++++--------- 3 files changed, 51 insertions(+), 28 deletions(-) diff --git a/src/mindytool/gui/FilterDialog.java b/src/mindytool/gui/FilterDialog.java index ceb1e8b..f89e539 100644 --- a/src/mindytool/gui/FilterDialog.java +++ b/src/mindytool/gui/FilterDialog.java @@ -35,8 +35,8 @@ public FilterDialog(Cons>> tagProvider) { } public void show(SearchConfig searchConfig) { - scale = Vars.mobile ? 0.55f : 0.75f; - cardSize = (int) (350 * scale); + scale = Vars.mobile ? 0.5f : 0.65f; + cardSize = (int) (300 * scale); cols = (int) Math.ceil(Core.graphics.getWidth() / (cardSize + CARD_GAP)); TagService.onUpdate(() -> show(searchConfig)); @@ -123,6 +123,7 @@ public void TagSelector(Table table, SearchConfig searchConfig, TagData tag) { table.pane(card -> { card.defaults().size(cardSize, 50); + int z = 0; for (int i = 0; i < tag.values().size; i++) { var value = tag.values().get(i); @@ -144,7 +145,7 @@ public void TagSelector(Table table, SearchConfig searchConfig, TagData tag) { .fillX()// .margin(12); - if (++i % cols == 0) { + if (++z % cols == 0) { card.row(); } } diff --git a/src/mindytool/gui/MapDialog.java b/src/mindytool/gui/MapDialog.java index 75b22de..8df41f5 100644 --- a/src/mindytool/gui/MapDialog.java +++ b/src/mindytool/gui/MapDialog.java @@ -141,8 +141,10 @@ private void SearchBar() { .padLeft(2)// .padRight(2); - searchBar.button(Icon.filterSmall, () -> loadingWrapper(() -> filterDialog.show(searchConfig))).padLeft(2).padRight(2).width(60); - searchBar.button(Icon.zoomSmall, () -> loadingWrapper(() -> request.getPage(this::handleMapResult))).padLeft(2).padRight(2).width(60); + searchBar.button(Icon.filterSmall, () -> loadingWrapper(() -> filterDialog.show(searchConfig))).padLeft(2) + .padRight(2).width(60); + searchBar.button(Icon.zoomSmall, () -> loadingWrapper(() -> request.getPage(this::handleMapResult))) + .padLeft(2).padRight(2).width(60); })// .fillX()// @@ -175,9 +177,8 @@ private Cell MapScrollContainer(Table parent) { return parent.pane(container -> { float sum = 0; - for (MapData mapData : mapsData) { - if (sum + Scl.scl(IMAGE_SIZE * 2) >= Math.max(Core.graphics.getHeight(), Core.graphics.getWidth())) { + if (sum + Scl.scl(IMAGE_SIZE * 2) >= Core.graphics.getWidth()) { container.row(); sum = 0; } @@ -189,8 +190,10 @@ private Cell MapScrollContainer(Table parent) { mapPreview.table(buttons -> { buttons.center(); buttons.defaults().size(50f); - buttons.button(Icon.download, Styles.emptyi, () -> handleDownloadMap(mapData)).padLeft(2).padRight(2); - buttons.button(Icon.info, Styles.emptyi, () -> Api.findMapById(mapData.id(), infoDialog::show)).tooltip("@info.title"); + buttons.button(Icon.download, Styles.emptyi, () -> handleDownloadMap(mapData)).padLeft(2) + .padRight(2); + buttons.button(Icon.info, Styles.emptyi, () -> Api.findMapById(mapData.id(), infoDialog::show)) + .tooltip("@info.title"); }).growX().height(50f); @@ -198,14 +201,16 @@ private Cell MapScrollContainer(Table parent) { mapPreview.stack(new MapImage(mapData.id()), new Table(mapName -> { mapName.top(); mapName.table(Styles.black3, c -> { - Label label = c.add(mapData.name()).style(Styles.outlineLabel).color(Color.white).top().growX().width(200f - 8f).get(); + Label label = c.add(mapData.name()).style(Styles.outlineLabel).color(Color.white).top() + .growX().width(200f - 8f).get(); label.setEllipsis(true); label.setAlignment(Align.center); }).growX().margin(1).pad(4).maxWidth(Scl.scl(200f - 8f)).padBottom(0); })).size(200f); mapPreview.row(); - mapPreview.table(stats -> DetailStats.draw(stats, mapData.likes(), mapData.dislikes(), mapData.downloadCount())).margin(8); + mapPreview.table(stats -> DetailStats.draw(stats, mapData.likes(), mapData.dislikes(), + mapData.downloadCount())).margin(8); }, () -> { @@ -222,10 +227,12 @@ private Cell MapScrollContainer(Table parent) { private void Footer() { table(footer -> { - footer.button(Icon.left, () -> request.previousPage(this::handleMapResult)).margin(4).pad(4).width(100).disabled(request.isLoading() || request.getPage() == 0 || request.isError()).height(40); + footer.button(Icon.left, () -> request.previousPage(this::handleMapResult)).margin(4).pad(4).width(100) + .disabled(request.isLoading() || request.getPage() == 0 || request.isError()).height(40); footer.table(Tex.buttonDisabled, table -> { - table.labelWrap(String.valueOf(request.getPage() + 1)).width(50).style(Styles.defaultLabel).labelAlign(0).center().fill(); + table.labelWrap(String.valueOf(request.getPage() + 1)).width(50).style(Styles.defaultLabel) + .labelAlign(0).center().fill(); }).pad(4).height(40); footer.button(Icon.edit, () -> { @@ -243,9 +250,11 @@ private void Footer() { .width(100)// .disabled(request.isLoading() || request.hasMore() == false || request.isError()).height(40); - footer.button(Icon.right, () -> request.nextPage(this::handleMapResult)).margin(4).pad(4).width(100).disabled(request.isLoading() || request.hasMore() == false || request.isError()).height(40); + footer.button(Icon.right, () -> request.nextPage(this::handleMapResult)).margin(4).pad(4).width(100) + .disabled(request.isLoading() || request.hasMore() == false || request.isError()).height(40); - footer.button("@upload", () -> Core.app.openURI(Config.UPLOAD_MAP_URL)).margin(4).pad(4).width(100).disabled(request.isLoading() || request.hasMore() == false || request.isError()).height(40); + footer.button("@upload", () -> Core.app.openURI(Config.UPLOAD_MAP_URL)).margin(4).pad(4).width(100) + .disabled(request.isLoading() || request.hasMore() == false || request.isError()).height(40); footer.bottom(); }).expandX().fillX(); diff --git a/src/mindytool/gui/SchematicDialog.java b/src/mindytool/gui/SchematicDialog.java index 3c4bd6c..1dcd718 100644 --- a/src/mindytool/gui/SchematicDialog.java +++ b/src/mindytool/gui/SchematicDialog.java @@ -39,7 +39,8 @@ public class SchematicDialog extends BaseDialog { private final SchematicInfoDialog infoDialog = new SchematicInfoDialog(); - private final FilterDialog filterDialog = new FilterDialog((tag) -> TagService.getTag(group -> tag.get(group.schematic))); + private final FilterDialog filterDialog = new FilterDialog( + (tag) -> TagService.getTag(group -> tag.get(group.schematic))); private Seq schematicsData = new Seq<>(); private final Debouncer debouncer = new Debouncer(500, TimeUnit.MILLISECONDS); @@ -143,8 +144,10 @@ private void SearchBar() { .padLeft(2)// .padRight(2); - searchBar.button(Icon.filterSmall, () -> loadingWrapper(() -> filterDialog.show(searchConfig))).padLeft(2).padRight(2).width(60); - searchBar.button(Icon.zoomSmall, () -> loadingWrapper(() -> request.getPage(this::handleSchematicResult))).padLeft(2).padRight(2).width(60); + searchBar.button(Icon.filterSmall, () -> loadingWrapper(() -> filterDialog.show(searchConfig))).padLeft(2) + .padRight(2).width(60); + searchBar.button(Icon.zoomSmall, () -> loadingWrapper(() -> request.getPage(this::handleSchematicResult))) + .padLeft(2).padRight(2).width(60); }).fillX().expandX(); @@ -160,7 +163,8 @@ private void SearchBar() { } private Cell Error(Table parent, String message) { - Cell error = parent.button(message, Styles.nonet, () -> request.getPage(this::handleSchematicResult)); + Cell error = parent.button(message, Styles.nonet, + () -> request.getPage(this::handleSchematicResult)); return error.center().labelAlign(0).expand().fill(); } @@ -177,7 +181,7 @@ private Cell SchematicScrollContainer(Table parent) { float sum = 0; for (SchematicData schematicData : schematicsData) { - if (sum + Scl.scl(IMAGE_SIZE * 2) >= Math.max(Core.graphics.getHeight(), Core.graphics.getWidth())) { + if (sum + Scl.scl(IMAGE_SIZE * 2) >= Core.graphics.getWidth()) { container.row(); sum = 0; } @@ -191,9 +195,13 @@ private Cell SchematicScrollContainer(Table parent) { schematicPreview.table(buttons -> { buttons.center(); buttons.defaults().size(50f); - buttons.button(Icon.copy, Styles.emptyi, () -> handleCopySchematic(schematicData)).padLeft(2).padRight(2); - buttons.button(Icon.download, Styles.emptyi, () -> handleDownloadSchematic(schematicData)).padLeft(2).padRight(2); - buttons.button(Icon.info, Styles.emptyi, () -> Api.findSchematicById(schematicData.id(), infoDialog::show)).tooltip("@info.title"); + buttons.button(Icon.copy, Styles.emptyi, () -> handleCopySchematic(schematicData)) + .padLeft(2).padRight(2); + buttons.button(Icon.download, Styles.emptyi, () -> handleDownloadSchematic(schematicData)) + .padLeft(2).padRight(2); + buttons.button(Icon.info, Styles.emptyi, + () -> Api.findSchematicById(schematicData.id(), infoDialog::show)) + .tooltip("@info.title"); }).growX().height(50f); @@ -220,7 +228,8 @@ private Cell SchematicScrollContainer(Table parent) { })).size(200f); schematicPreview.row(); - schematicPreview.table(stats -> DetailStats.draw(stats, schematicData.likes(), schematicData.dislikes(), schematicData.downloadCount())).margin(8); + schematicPreview.table(stats -> DetailStats.draw(stats, schematicData.likes(), + schematicData.dislikes(), schematicData.downloadCount())).margin(8); }, () -> { if (button[0].childrenPressed()) @@ -232,7 +241,8 @@ private Cell SchematicScrollContainer(Table parent) { if (!state.rules.schematicsAllowed) { ui.showInfo("@schematic.disabled"); } else { - handleDownloadSchematicData(schematicData, data -> control.input.useSchematic(Utils.readSchematic(data))); + handleDownloadSchematicData(schematicData, + data -> control.input.useSchematic(Utils.readSchematic(data))); hide(); } } @@ -253,10 +263,12 @@ private Cell SchematicScrollContainer(Table parent) { private void Footer() { table(footer -> { - footer.button(Icon.left, () -> request.previousPage(this::handleSchematicResult)).margin(4).pad(4).width(100).disabled(request.isLoading() || request.getPage() == 0 || request.isError()).height(40); + footer.button(Icon.left, () -> request.previousPage(this::handleSchematicResult)).margin(4).pad(4) + .width(100).disabled(request.isLoading() || request.getPage() == 0 || request.isError()).height(40); footer.table(Tex.buttonDisabled, table -> { - table.labelWrap(String.valueOf(request.getPage() + 1)).width(50).style(Styles.defaultLabel).labelAlign(0).center().fill(); + table.labelWrap(String.valueOf(request.getPage() + 1)).width(50).style(Styles.defaultLabel) + .labelAlign(0).center().fill(); }).pad(4).height(40); footer.button(Icon.edit, () -> { @@ -280,7 +292,8 @@ private void Footer() { .width(100)// .disabled(request.isLoading() || request.hasMore() == false || request.isError()).height(40); - footer.button("@upload", () -> Core.app.openURI(Config.UPLOAD_SCHEMATIC_URL)).margin(4).pad(4).width(100).disabled(request.isLoading() || request.hasMore() == false || request.isError()).height(40); + footer.button("@upload", () -> Core.app.openURI(Config.UPLOAD_SCHEMATIC_URL)).margin(4).pad(4).width(100) + .disabled(request.isLoading() || request.hasMore() == false || request.isError()).height(40); footer.bottom(); }).expandX().fillX();