Skip to content

平滑进度条#5805

Merged
Glavo merged 11 commits intoHMCL-dev:mainfrom
Glavo:progress
Mar 18, 2026
Merged

平滑进度条#5805
Glavo merged 11 commits intoHMCL-dev:mainfrom
Glavo:progress

Conversation

@Glavo
Copy link
Member

@Glavo Glavo commented Mar 18, 2026

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates HMCL’s JFoenix progress bar rendering to produce smoother determinate progress transitions, aligning both the skin implementation and CSS styling.

Changes:

  • Reworked JFXProgressBarSkin to render the bar as a Rectangle and add a short determinate width animation (when enabled).
  • Added a smoothProgress toggle to JFXProgressBar, and used it in TaskListPane to suppress animations during cell rebinding.
  • Updated root.css progress bar styling to use -fx-fill for the new Rectangle-based bar.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
HMCL/src/main/resources/assets/css/root.css Updates progress bar bar styling to match Rectangle rendering (-fx-fill).
HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java Temporarily disables smooth progress during list cell rebinding to avoid unwanted animations.
HMCL/src/main/java/com/jfoenix/skins/JFXProgressBarSkin.java Implements smooth determinate animation + refactors bar node to a Rectangle.
HMCL/src/main/java/com/jfoenix/controls/JFXProgressBar.java Adds a smoothProgress toggle used by the skin to enable/disable smoothing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +149 to +166
private Timeline createIndeterminateTransition() {
Timeline indeterminateTransition = new Timeline(
new KeyFrame(
Duration.ZERO,
new KeyValue(clip.widthProperty(), 0.0, Interpolator.EASE_IN),
new KeyValue(clip.translateXProperty(), 0, Interpolator.LINEAR)
new KeyValue(bar.widthProperty(), 0.0, Interpolator.EASE_IN),
new KeyValue(bar.translateXProperty(), 0, Interpolator.LINEAR)
),
new KeyFrame(
DURATION.multiply(0.5),
new KeyValue(clip.widthProperty(), w * 0.4, Interpolator.LINEAR)
INDETERMINATE_DURATION.multiply(0.5),
new KeyValue(bar.widthProperty(), fullWidth * 0.4, Interpolator.LINEAR)
),
new KeyFrame(
DURATION.multiply(0.9),
new KeyValue(clip.translateXProperty(), w, Interpolator.LINEAR)
INDETERMINATE_DURATION.multiply(0.9),
new KeyValue(bar.translateXProperty(), fullWidth, Interpolator.LINEAR)
),
new KeyFrame(
DURATION,
new KeyValue(clip.widthProperty(), 0.0, Interpolator.EASE_OUT)
INDETERMINATE_DURATION,
new KeyValue(bar.widthProperty(), 0.0, Interpolator.EASE_OUT)
Comment on lines +52 to +60
private boolean smoothProgress = true;

public boolean isSmoothProgress() {
return smoothProgress;
}

public void setSmoothProgress(boolean smoothProgress) {
this.smoothProgress = smoothProgress;
}
Comment on lines +135 to 144
clearAnimation();
if (isTreeShowing && playProgressAnimation
&& AnimationUtils.isAnimationEnabled()
&& getSkinnable().isSmoothProgress()) {
transition = createDeterminateTransition(progress);
transition.playFromStart();
} else {
bar.setWidth(computeBarWidth(progress));
}
}
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces “smooth” (animated) determinate progress updates for the custom JFXProgressBar, and adjusts styling/usage to reduce visual jank during list-cell reuse in the task list UI.

Changes:

  • Reworked JFXProgressBarSkin to animate determinate progress width changes and refactor indeterminate animation handling.
  • Added a smoothProgress toggle on JFXProgressBar, and used it in TaskListPane to disable animations during unbind/rebind.
  • Simplified the progress bar CSS selector for .bar.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
HMCL/src/main/resources/assets/css/root.css Simplifies progress bar .bar selector styling.
HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskListPane.java Temporarily disables smooth progress during cell unbind/rebind to avoid unwanted animations.
HMCL/src/main/java/com/jfoenix/skins/JFXProgressBarSkin.java Implements/updates determinate smooth width animation and refactors indeterminate transition logic.
HMCL/src/main/java/com/jfoenix/controls/JFXProgressBar.java Adds a new smoothProgress flag to control animation behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

if (isIndeterminate != wasIndeterminate) {
wasIndeterminate = isIndeterminate;
clearAnimation();
clip.setTranslateX(0);
@Glavo Glavo merged commit fbb52f4 into HMCL-dev:main Mar 18, 2026
2 checks passed
@Glavo Glavo deleted the progress branch March 18, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants