From 33c87883f8e6b2801b77fa5fa7e1bfcd422c2116 Mon Sep 17 00:00:00 2001 From: palexdev Date: Fri, 7 Jun 2024 12:59:47 +0200 Subject: [PATCH] [Components] :bug: MFXFabSkin: the scale animation must also reposition the label otherwise new icons may end up being misaligned Signed-off-by: palexdev --- .../palexdev/mfxcomponents/skins/MFXFabSkin.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/components/src/main/java/io/github/palexdev/mfxcomponents/skins/MFXFabSkin.java b/modules/components/src/main/java/io/github/palexdev/mfxcomponents/skins/MFXFabSkin.java index a5576d59..e933737d 100644 --- a/modules/components/src/main/java/io/github/palexdev/mfxcomponents/skins/MFXFabSkin.java +++ b/modules/components/src/main/java/io/github/palexdev/mfxcomponents/skins/MFXFabSkin.java @@ -19,7 +19,11 @@ package io.github.palexdev.mfxcomponents.skins; import io.github.palexdev.mfxcomponents.behaviors.MFXButtonBehaviorBase; +import io.github.palexdev.mfxcomponents.controls.fab.MFXFab; import io.github.palexdev.mfxcomponents.controls.fab.MFXFabBase; +import io.github.palexdev.mfxcomponents.theming.base.Variant; +import io.github.palexdev.mfxcomponents.theming.base.WithVariants; +import io.github.palexdev.mfxcomponents.theming.enums.FABVariants; import io.github.palexdev.mfxcore.controls.BoundLabel; import io.github.palexdev.mfxcore.utils.fx.LayoutUtils; import io.github.palexdev.mfxeffects.animations.Animations; @@ -72,7 +76,7 @@ public class MFXFabSkin extends MFXButtonSkin icon != null, KeyFrames.of(SCALE_UP_DURATION, icon.opacityProperty(), 1.0, SCALE_CURVE)) + .addIf(icon != null, KeyFrames.of(1, e -> label.setTranslateX(computeLabelDisplacement(w)))) + .addIf(icon != null, () -> KeyFrames.of(SCALE_UP_DURATION, icon.opacityProperty(), 1.0, SCALE_CURVE)) .getAnimation(); } }