Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import javafx.application.Platform;
import javafx.beans.InvalidationListener;
import javafx.geometry.Insets;
import javafx.geometry.VPos;
import javafx.scene.control.Label;
import javafx.scene.input.DragEvent;
import javafx.scene.input.TransferMode;
Expand Down Expand Up @@ -75,11 +74,11 @@ public OfflineAccountSkinPane(OfflineAccount account) {

BorderPane pane = new BorderPane();

SkinCanvas canvas = new SkinCanvas(TexturesLoader.getDefaultSkinImage(), 300, 300, true);
SkinCanvas canvas = new SkinCanvas(TexturesLoader.getDefaultSkinImage(), 260, 260, true);
StackPane canvasPane = new StackPane(canvas);
canvasPane.setPrefWidth(300);
canvasPane.setPrefHeight(300);
pane.setCenter(canvas);
canvasPane.setPrefWidth(260);
canvasPane.setPrefHeight(260);
pane.setCenter(canvasPane);
canvas.getAnimationPlayer().addSkinAnimation(new SkinAniWavingArms(100, 2000, 7.5, canvas), new SkinAniRunning(100, 100, 30, canvas));
canvas.enableRotation(.5);

Expand All @@ -101,12 +100,12 @@ public OfflineAccountSkinPane(OfflineAccount account) {
});

StackPane skinOptionPane = new StackPane();
skinOptionPane.setMaxWidth(300);
VBox optionPane = new VBox(skinItem, skinOptionPane);
pane.setRight(optionPane);
pane.setRight(skinOptionPane);

skinSelector.maxWidthProperty().bind(skinOptionPane.maxWidthProperty().multiply(0.7));
capeSelector.maxWidthProperty().bind(skinOptionPane.maxWidthProperty().multiply(0.7));
skinSelector.setMaxWidth(Double.MAX_VALUE);
capeSelector.setMaxWidth(Double.MAX_VALUE);
modelCombobox.setMaxWidth(Double.MAX_VALUE);
cslApiField.setMaxWidth(Double.MAX_VALUE);

layout.setBody(pane);

Expand Down Expand Up @@ -180,50 +179,63 @@ public OfflineAccountSkinPane(OfflineAccount account) {
}
}, skinItem.selectedDataProperty(), cslApiField.textProperty(), modelCombobox.valueProperty(), skinSelector.valueProperty(), capeSelector.valueProperty());

VBox right = new VBox();
right.setPadding(new Insets(0, 0, 0, 10));
right.setSpacing(12);
right.setPrefWidth(230);
HBox.setHgrow(right, Priority.ALWAYS);

HBox body = new HBox(20);
skinItem.setPrefWidth(170);
skinItem.setMinWidth(170);
body.getChildren().add(skinItem);

skinOptionPane.getChildren().setAll(body);

FXUtils.onChangeAndOperate(skinItem.selectedDataProperty(), selectedData -> {
GridPane gridPane = new GridPane();
// Increase bottom padding to prevent the prompt from overlapping with the dialog action area

gridPane.setPadding(new Insets(0, 0, 45, 10));
gridPane.setHgap(16);
gridPane.setVgap(8);
gridPane.getColumnConstraints().setAll(new ColumnConstraints(), FXUtils.getColumnHgrowing());

switch (selectedData) {
case DEFAULT:
case STEVE:
case ALEX:
break;
case LITTLE_SKIN:
HintPane hint = new HintPane(MessageDialogPane.MessageType.INFO);
hint.setText(i18n("account.skin.type.little_skin.hint"));

// Spanning two columns and expanding horizontally
GridPane.setColumnSpan(hint, 2);
GridPane.setHgrow(hint, Priority.ALWAYS);
hint.setMaxWidth(Double.MAX_VALUE);

// Force top alignment within cells (to avoid vertical offset caused by the baseline)
GridPane.setValignment(hint, VPos.TOP);

// Set a fixed height as the preferred height to prevent the GridPane from stretching or leaving empty space.
hint.setMaxHeight(Region.USE_PREF_SIZE);
hint.setMinHeight(Region.USE_PREF_SIZE);

gridPane.addRow(0, hint);
break;
case LOCAL_FILE:
gridPane.setPadding(new Insets(0, 0, 0, 10));
gridPane.addRow(0, new Label(i18n("account.skin.model")), modelCombobox);
gridPane.addRow(1, new Label(i18n("account.skin")), skinSelector);
gridPane.addRow(2, new Label(i18n("account.cape")), capeSelector);
break;
case CUSTOM_SKIN_LOADER_API:
gridPane.addRow(0, new Label(i18n("account.skin.type.csl_api.location")), cslApiField);
break;
right.getChildren().clear();

if (selectedData != null) {
switch (selectedData) {
case DEFAULT:
case STEVE:
case ALEX:
break;

case LITTLE_SKIN:
HintPane hint = new HintPane(MessageDialogPane.MessageType.INFO);
hint.setText(i18n("account.skin.type.little_skin.hint"));

hint.setMaxWidth(Double.MAX_VALUE);

right.getChildren().add(hint);
break;

case LOCAL_FILE:
right.getChildren().addAll(
new Label(i18n("account.skin.model")),
modelCombobox,
new Label(i18n("account.skin")),
skinSelector,
new Label(i18n("account.cape")),
capeSelector
);
break;

case CUSTOM_SKIN_LOADER_API:
right.getChildren().addAll(
new Label(i18n("account.skin.type.csl_api.location")),
cslApiField
);
break;
Comment on lines +214 to +230

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Grouping each label and its corresponding control inside a small VBox with tighter spacing (e.g., 4px) improves the visual hierarchy. Currently, because all elements are added directly to the parent VBox with a uniform spacing of 12px, the labels are equally spaced from the controls above and below them, which reduces readability.

                    case LOCAL_FILE:
                        right.getChildren().addAll(
                            new VBox(4, new Label(i18n("account.skin.model")), modelCombobox),
                            new VBox(4, new Label(i18n("account.skin")), skinSelector),
                            new VBox(4, new Label(i18n("account.cape")), capeSelector)
                        );
                        break;

                    case CUSTOM_SKIN_LOADER_API:
                        right.getChildren().add(
                            new VBox(4, new Label(i18n("account.skin.type.csl_api.location")), cslApiField)
                        );
                        break;

}
}

skinOptionPane.getChildren().setAll(gridPane);
if (right.getChildren().isEmpty()) {
body.getChildren().remove(right);
} else if (!body.getChildren().contains(right)) {
body.getChildren().add(right);
}
});
Comment thread
KSSJW marked this conversation as resolved.

JFXButton acceptButton = new JFXButton(i18n("button.ok"));
Expand Down