Skip to content

Commit 8a770df

Browse files
committed
qwq
1 parent 1b0b36a commit 8a770df

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

HMCL/src/main/java/com/jfoenix/controls/JFXRippler.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import javafx.scene.shape.Rectangle;
4747
import javafx.scene.shape.Shape;
4848
import javafx.util.Duration;
49-
import org.jackhuang.hmcl.theme.Themes;
5049
import org.jackhuang.hmcl.ui.animation.AnimationUtils;
5150
import org.jackhuang.hmcl.ui.animation.Motion;
5251

@@ -143,9 +142,6 @@ public JFXRippler(Node control, RipplerMask mask, RipplerPos pos) {
143142
}
144143

145144
boolean isEntered = event.getEventType() == MouseEvent.MOUSE_ENTERED;
146-
Color onSurface = Themes.getColorScheme().getOnSurface();
147-
hoverOverlay.setFill(Color.color(onSurface.getRed(), onSurface.getGreen(), onSurface.getBlue(), 0.04));
148-
149145
coverAnimation = new Timeline(new KeyFrame(Motion.SHORT4,
150146
new KeyValue(hoverOverlay.opacityProperty(), isEntered ? 1 : 0, isEntered ? Motion.EASE_IN : Motion.EASE_OUT)));
151147
coverAnimation.play();
@@ -161,8 +157,6 @@ public JFXRippler(Node control, RipplerMask mask, RipplerPos pos) {
161157

162158
private void interpolateBackground(double frac) {
163159
if (hoverOverlay == null) return;
164-
Color onSurface = Themes.getColorScheme().getOnSurface();
165-
hoverOverlay.setFill(Color.color(onSurface.getRed(), onSurface.getGreen(), onSurface.getBlue(), 0.04));
166160
hoverOverlay.setOpacity(frac);
167161
}
168162

@@ -177,6 +171,16 @@ protected final void createRippleUI() {
177171
hoverOverlay.setCache(true);
178172
hoverOverlay.setCacheHint(CacheHint.SPEED);
179173
hoverOverlay.setOpacity(0);
174+
175+
hoverOverlay.fillProperty().bind(Bindings.createObjectBinding(() -> {
176+
Paint currentFill = getRipplerFill();
177+
if (currentFill instanceof Color fill) {
178+
return Color.color(fill.getRed(), fill.getGreen(), fill.getBlue(), 0.15);
179+
} else {
180+
return currentFill;
181+
}
182+
}, ripplerFillProperty()));
183+
180184
ripplerPane.getChildren().addAll(hoverOverlay, rippler);
181185
getChildren().add(ripplerPane);
182186
}

0 commit comments

Comments
 (0)