diff --git a/src/AtomUI.Controls/Expander/Expander.cs b/src/AtomUI.Controls/Expander/Expander.cs index 0ec91b3..5d8dce8 100644 --- a/src/AtomUI.Controls/Expander/Expander.cs +++ b/src/AtomUI.Controls/Expander/Expander.cs @@ -166,9 +166,7 @@ public class Expander : AvaloniaExpander } #endregion - - private bool _animating = false; - private bool _enableAnimation = true; + private AnimationTargetPanel? _animationTarget; private Border? _headerDecorator; private IconButton? _expandButton; @@ -182,13 +180,10 @@ public class Expander : AvaloniaExpander TokenResourceBinder.CreateTokenBinding(this, MotionDurationProperty, GlobalResourceKey.MotionDurationSlow); TokenResourceBinder.CreateGlobalResourceBinding(this, BorderThicknessProperty, GlobalResourceKey.BorderThickness, BindingPriority.Template, new RenderScaleAwareThicknessConfigure(this)); - // SetupHeaderLayout(); SetupEffectiveBorderThickness(); SetupExpanderBorderThickness(); SetupIconButton(); - _enableAnimation = false; HandleExpandedChanged(); - _enableAnimation = true; if (_expandButton is not null) { _expandButton.Click += (sender, args) => { @@ -266,7 +261,7 @@ public class Expander : AvaloniaExpander var position = e.GetPosition(_headerDecorator); if (_headerDecorator is not null) { var targetRect = new Rect(_headerDecorator.Bounds.Size); - if (targetRect.Contains(position) && !_animating) { + if (targetRect.Contains(position)) { IsExpanded = !IsExpanded; } } diff --git a/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs b/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs index aa43033..dd3c480 100644 --- a/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs +++ b/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs @@ -408,6 +408,15 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey ToolTipArrowSize = new TokenResourceKey("ToolTip.ToolTipArrowSize"); } + public static class TreeViewResourceKey + { + public static readonly TokenResourceKey TitleHeight = new TokenResourceKey("TreeView.TitleHeight"); + public static readonly TokenResourceKey NodeHoverBg = new TokenResourceKey("TreeView.NodeHoverBg"); + public static readonly TokenResourceKey NodeSelectedBg = new TokenResourceKey("TreeView.NodeSelectedBg"); + public static readonly TokenResourceKey DirectoryNodeSelectedColor = new TokenResourceKey("TreeView.DirectoryNodeSelectedColor"); + public static readonly TokenResourceKey DirectoryNodeSelectedBg = new TokenResourceKey("TreeView.DirectoryNodeSelectedBg"); + } + public static class CaptionButtonResourceKey { public static readonly TokenResourceKey HoverBackgroundColor = new TokenResourceKey("CaptionButton.HoverBackgroundColor"); diff --git a/src/AtomUI.Controls/TreeView/TreeView.cs b/src/AtomUI.Controls/TreeView/TreeView.cs new file mode 100644 index 0000000..be86a96 --- /dev/null +++ b/src/AtomUI.Controls/TreeView/TreeView.cs @@ -0,0 +1,8 @@ +namespace AtomUI.Controls; + +using AvaloniaTreeView = Avalonia.Controls.TreeView; + +public class TreeView : AvaloniaTreeView +{ + +} \ No newline at end of file diff --git a/src/AtomUI.Controls/TreeView/TreeViewItem.cs b/src/AtomUI.Controls/TreeView/TreeViewItem.cs new file mode 100644 index 0000000..038452d --- /dev/null +++ b/src/AtomUI.Controls/TreeView/TreeViewItem.cs @@ -0,0 +1,8 @@ +namespace AtomUI.Controls; + +using AvaloniaTreeItem = Avalonia.Controls.TreeViewItem; + +public class TreeViewItem : AvaloniaTreeItem +{ + +} \ No newline at end of file diff --git a/src/AtomUI.Controls/TreeView/TreeViewItemTheme.cs b/src/AtomUI.Controls/TreeView/TreeViewItemTheme.cs new file mode 100644 index 0000000..3078d8f --- /dev/null +++ b/src/AtomUI.Controls/TreeView/TreeViewItemTheme.cs @@ -0,0 +1,6 @@ +namespace AtomUI.Controls; + +public class TreeViewItemTheme +{ + +} \ No newline at end of file diff --git a/src/AtomUI.Controls/TreeView/TreeViewTheme.cs b/src/AtomUI.Controls/TreeView/TreeViewTheme.cs new file mode 100644 index 0000000..1701e4c --- /dev/null +++ b/src/AtomUI.Controls/TreeView/TreeViewTheme.cs @@ -0,0 +1,6 @@ +namespace AtomUI.Controls; + +public class TreeViewTheme +{ + +} \ No newline at end of file diff --git a/src/AtomUI.Controls/TreeView/TreeViewToken.cs b/src/AtomUI.Controls/TreeView/TreeViewToken.cs new file mode 100644 index 0000000..d8634cd --- /dev/null +++ b/src/AtomUI.Controls/TreeView/TreeViewToken.cs @@ -0,0 +1,55 @@ +using AtomUI.Theme.TokenSystem; +using Avalonia.Media; + +namespace AtomUI.Controls; + +[ControlDesignToken] +internal class TreeViewToken : AbstractControlDesignToken +{ + public const string ID = "TreeView"; + + public TreeViewToken() + : base(ID) + { + } + + /// + /// 节点标题高度 + /// + public double TitleHeight { get; set; } + + /// + /// 节点悬浮态背景色 + /// + public Color NodeHoverBg { get; set; } + + /// + /// 节点选中态背景色 + /// + public Color NodeSelectedBg { get; set; } + + #region 内部 Token 定义 + + /// + /// 目录树节点选中文字颜色 + /// + public Color DirectoryNodeSelectedColor { get; set; } + + /// + /// 目录树节点选中背景色 + /// + public Color DirectoryNodeSelectedBg { get; set; } + + #endregion + + internal override void CalculateFromAlias() + { + base.CalculateFromAlias(); + TitleHeight = _globalToken.HeightToken.ControlHeightSM; + NodeHoverBg = _globalToken.ControlItemBgHover; + NodeSelectedBg = _globalToken.ControlItemBgActive; + + DirectoryNodeSelectedColor = _globalToken.ColorTextLightSolid; + DirectoryNodeSelectedBg = _globalToken.ColorToken.ColorPrimaryToken.ColorPrimary; + } +} \ No newline at end of file