Skip to content

Commit 8bd8ae9

Browse files
committed
Merge
1 parent a081bd1 commit 8bd8ae9

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/ResourcePackListPage.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import javafx.scene.Node;
1313
import javafx.scene.control.*;
1414
import javafx.scene.image.Image;
15-
import javafx.scene.image.ImageView;
1615
import javafx.scene.input.KeyCode;
1716
import javafx.scene.input.KeyEvent;
1817
import javafx.scene.layout.HBox;
@@ -461,7 +460,7 @@ private static final class ResourcePackListCell extends MDListCell<ResourcePackI
461460
private final ResourcePackListPage page;
462461

463462
private final JFXCheckBox checkBox;
464-
private final ImageView imageView = new ImageView();
463+
private final ImageContainer imageContainer = new ImageContainer(24);
465464
private final TwoLineListItem content = new TwoLineListItem();
466465
private final JFXButton btnReveal = new JFXButton();
467466
private final JFXButton btnInfo = new JFXButton();
@@ -498,20 +497,16 @@ public void fire() {
498497
}
499498
};
500499

501-
imageView.setFitWidth(24);
502-
imageView.setFitHeight(24);
503-
imageView.setPreserveRatio(true);
504-
505500
HBox.setHgrow(content, Priority.ALWAYS);
506501
content.setMouseTransparent(true);
507502

508503
btnReveal.getStyleClass().add("toggle-icon4");
509-
btnReveal.setGraphic(FXUtils.limitingSize(SVG.FOLDER.createIcon(24), 24, 24));
504+
btnReveal.setGraphic(SVG.FOLDER.createIcon());
510505

511506
btnInfo.getStyleClass().add("toggle-icon4");
512-
btnInfo.setGraphic(FXUtils.limitingSize(SVG.INFO.createIcon(24), 24, 24));
507+
btnInfo.setGraphic(SVG.INFO.createIcon());
513508

514-
root.getChildren().setAll(checkBox, imageView, content, btnReveal, btnInfo);
509+
root.getChildren().setAll(checkBox, imageContainer, content, btnReveal, btnInfo);
515510

516511
setSelectable();
517512

@@ -528,7 +523,7 @@ protected void updateControl(ResourcePackInfoObject item, boolean empty) {
528523
}
529524
this.object = item;
530525
ResourcePackFile file = item.getFile();
531-
imageView.setImage(item.getIcon());
526+
imageContainer.setImage(item.getIcon());
532527

533528
content.setTitle(file.getFileName());
534529
content.setSubtitle(file.getFileNameWithExtension());
@@ -566,9 +561,8 @@ private static final class ResourcePackInfoDialog extends JFXDialogLayout {
566561
Stage stage = Controllers.getStage();
567562
maxWidthProperty().bind(stage.widthProperty().multiply(0.7));
568563

569-
ImageView imageView = new ImageView();
570-
imageView.setImage(packInfoObject.getIcon());
571-
FXUtils.limitSize(imageView, 40, 40);
564+
ImageContainer imageContainer = new ImageContainer(40);
565+
imageContainer.setImage(packInfoObject.getIcon());
572566

573567
TwoLineListItem title = new TwoLineListItem();
574568
title.setTitle(pack.getFileName());
@@ -580,7 +574,7 @@ private static final class ResourcePackInfoDialog extends JFXDialogLayout {
580574
title.addTagWarning(getWarning(compatibility));
581575
}
582576

583-
titleContainer.getChildren().setAll(FXUtils.limitingSize(imageView, 40, 40), title);
577+
titleContainer.getChildren().setAll(imageContainer, title);
584578
setHeading(titleContainer);
585579

586580
Label description = new Label(Objects.requireNonNullElse(pack.getDescription(), "").toString());

0 commit comments

Comments
 (0)