From de934747901cb4707589607579431ac13e5b8915 Mon Sep 17 00:00:00 2001 From: Dime Date: Fri, 22 May 2026 19:22:47 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(ui):=20=E4=BF=AE=E5=A4=8D=20MyListItem?= =?UTF-8?q?=20=E9=80=89=E4=B8=AD=E6=97=B6=E7=A5=9E=E7=A7=98=E7=9A=84?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=E6=9D=A1=E9=AB=98=E5=BA=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controls/MyListItem.xaml.cs | 60 +++++++++++++------ 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/Plain Craft Launcher 2/Controls/MyListItem.xaml.cs b/Plain Craft Launcher 2/Controls/MyListItem.xaml.cs index 061b3abbc..3dd78673b 100644 --- a/Plain Craft Launcher 2/Controls/MyListItem.xaml.cs +++ b/Plain Craft Launcher 2/Controls/MyListItem.xaml.cs @@ -832,7 +832,7 @@ public void SetChecked(bool value, bool user, bool anime) } } - // 更改动画 + double customHeight = 20d; // 修改左侧神秘动画条的高度 if (IsLoaded && ModAnimation.AniControlEnabled == 0 && anime) // 防止默认属性变更触发动画 { @@ -840,16 +840,26 @@ public void SetChecked(bool value, bool user, bool anime) if (Checked) { // 由无变有 - if (!(RectCheck == null)) + if (RectCheck != null) { - var Delta = 20; - Anim.Add(ModAnimation.AaHeight(RectCheck, Delta * 0.4d, 200, - Ease: new ModAnimation.AniEaseOutFluent(ModAnimation.AniEasePower.Weak))); - Anim.Add(ModAnimation.AaHeight(RectCheck, Delta * 0.6d, 300, - Ease: new ModAnimation.AniEaseOutBack(ModAnimation.AniEasePower.Weak))); - Anim.Add(ModAnimation.AaOpacity(RectCheck, 1d - RectCheck.Opacity, 30)); + // 统一静态属性:固定高度、居中对齐、无额外边距 + RectCheck.Height = customHeight; RectCheck.VerticalAlignment = VerticalAlignment.Center; RectCheck.Margin = new Thickness(-1, 0d, 0d, 0d); + RectCheck.Opacity = 1d; + + // 初始化缩放中心为正中心 + var scale = new ScaleTransform(1d, 0d); + RectCheck.RenderTransformOrigin = new Point(0.5d, 0.5d); + RectCheck.RenderTransform = scale; + + // 动画:让 ScaleY 从 0 弹性放大到 1 + Anim.Add(ModAnimation.AaDouble( + i => scale.ScaleY = Math.Max(0d, scale.ScaleY + (double)i), + 1d - scale.ScaleY, + 300, + Ease: new ModAnimation.AniEaseOutBack(ModAnimation.AniEasePower.Weak) + )); } Anim.Add(ModAnimation.AaColor(this, ForegroundProperty, @@ -858,13 +868,24 @@ public void SetChecked(bool value, bool user, bool anime) else { // 由有变无 - if (!(RectCheck == null)) + if (RectCheck != null) { - // Anim.Add(AaWidth(RectCheck, -RectCheck.Width, 120,, New AniEaseInFluent)) - Anim.Add(ModAnimation.AaHeight(RectCheck, -RectCheck.ActualHeight, 120, - Ease: new ModAnimation.AniEaseInFluent(ModAnimation.AniEasePower.Weak))); + if (!(RectCheck.RenderTransform is ScaleTransform)) + { + RectCheck.RenderTransformOrigin = new Point(0.5d, 0.5d); + RectCheck.RenderTransform = new ScaleTransform(1d, 1d); + } + + var scale = (ScaleTransform)RectCheck.RenderTransform; + + // 动画:让 ScaleY 从当前值缩减到 0 + Anim.Add(ModAnimation.AaDouble( + i => scale.ScaleY = Math.Max(0d, scale.ScaleY + (double)i), + -scale.ScaleY, + 120, + Ease: new ModAnimation.AniEaseInFluent(ModAnimation.AniEasePower.Weak) + )); Anim.Add(ModAnimation.AaOpacity(RectCheck, -RectCheck.Opacity, 70, 40)); - RectCheck.VerticalAlignment = VerticalAlignment.Center; } Anim.Add(ModAnimation.AaColor(this, ForegroundProperty, "ColorBrush1", 120)); @@ -878,31 +899,32 @@ public void SetChecked(bool value, bool user, bool anime) ModAnimation.AniStop("MyListItem Checked " + Uuid); if (Checked) { - if (!(RectCheck == null)) + if (RectCheck != null) { - RectCheck.Height = double.NaN; - RectCheck.Margin = new Thickness(-1, 6d, 0d, 6d); + RectCheck.Height = customHeight; // 应用自定义固定高度 + RectCheck.Margin = new Thickness(-1, 0d, 0d, 0d); RectCheck.Opacity = 1d; - RectCheck.VerticalAlignment = VerticalAlignment.Stretch; + RectCheck.VerticalAlignment = VerticalAlignment.Center; // 居中 + RectCheck.RenderTransform = null; // 清除缩放 } SetResourceReference(ForegroundProperty, Height < 40d ? "ColorBrush3" : "ColorBrush2"); } else { - if (!(RectCheck == null)) + if (RectCheck != null) { RectCheck.Height = 0d; RectCheck.Margin = new Thickness(-1, 0d, 0d, 0d); RectCheck.Opacity = 0d; RectCheck.VerticalAlignment = VerticalAlignment.Center; + RectCheck.RenderTransform = null; } SetResourceReference(ForegroundProperty, "ColorBrush1"); } } } - catch (Exception ex) { ModBase.Log(ex, "设置 Checked 失败"); From f3114906de92981e66f0c2569ea90dfb62c46a76 Mon Sep 17 00:00:00 2001 From: Dime Date: Sat, 23 May 2026 08:48:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?style:=20=E8=B0=83=E6=95=B4=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plain Craft Launcher 2/Controls/MyListItem.xaml.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plain Craft Launcher 2/Controls/MyListItem.xaml.cs b/Plain Craft Launcher 2/Controls/MyListItem.xaml.cs index 3dd78673b..5fa580b94 100644 --- a/Plain Craft Launcher 2/Controls/MyListItem.xaml.cs +++ b/Plain Craft Launcher 2/Controls/MyListItem.xaml.cs @@ -832,7 +832,7 @@ public void SetChecked(bool value, bool user, bool anime) } } - double customHeight = 20d; // 修改左侧神秘动画条的高度 + var customHeight = 20d; // 修改左侧神秘动画条的高度 if (IsLoaded && ModAnimation.AniControlEnabled == 0 && anime) // 防止默认属性变更触发动画 { @@ -840,7 +840,7 @@ public void SetChecked(bool value, bool user, bool anime) if (Checked) { // 由无变有 - if (RectCheck != null) + if (RectCheck is not null) { // 统一静态属性:固定高度、居中对齐、无额外边距 RectCheck.Height = customHeight; @@ -868,7 +868,7 @@ public void SetChecked(bool value, bool user, bool anime) else { // 由有变无 - if (RectCheck != null) + if (RectCheck is not null) { if (!(RectCheck.RenderTransform is ScaleTransform)) {